Given that the sample output you provided is not formatted at all like you said you wanted and, instead, just changes the <comma>s in your CSV file to <space>s; I don't know whether you want the input data to be left-justified in the output or right-justified.
Assuming that you want left-justified text in your twenty character and ten character output fields, two (of many) simple ways to do what you want include an awk script:
and a shell while read loop:
if you want right-justified text instead of left-justified text, remove both of the minus signs from the printf format strings in either of the above scripts.
This User Gave Thanks to Don Cragun For This Post:
Hi ,
I have a file with contents as below:
Contract Cancellation Report UARCNCL
LOS CODE DATE REAS TYPE AMOUNT AMOUNT LETTER BY
========= ======= ==== ==== ==== ========= ==== ====
8174739 7641509 1S NONE CRCD 30-JUN-2008 NPAR N .00 .00 CCAN
8678696 8091709 1S NONE DDEB 30-JUN-2008... (14 Replies)
Hi,
Request To guide me in writing a shell program for the following requirement:
Example:if the Input File contains the follwing data
Input File Data:
80723240029,12,323,443,88,98,7,98,67,87
80723240030,12,56,6,,,3,12,56,6,7,2,3,12,56,6,7,2,3,88,98,7,98,67,87... (5 Replies)
I need to convert a password protected excel file which will be in UNIX server to a comma separated file. For this I need to open the excel file in UNIX box but the UNIX box doesn't prompt for password instead it is opened in an encrypted manner.
I could manually ftp the excel file to local... (2 Replies)
Hi All,
I wrote a script to extract data from Oracle DB and place it in a text file , and I have coverted .txt file into comma seperated .csv file and I sent it to my mail box .
I can get .xls file in my inbox.I am getting all data in same column and in different rows , without column... (1 Reply)
Open to a sed/awk/or perl alternative so that i can stick command into my bash script.
This is a problem I resolve using a combination of cut commands - but that is getting convoluted. So would really appreciate it if someone could provide a better solution which basically replaces all... (3 Replies)
Hello Friends,
I am new to UNIX shell scripting. Using bash....Could you please help me in converting a flat file into an XML style output file.
Flat file: (Input File entries looks like this)
John Miller: 617-569-7996:15 Bunting lane, staten Island, NY: 10/21/79: 60600
The... (4 Replies)
Hi All,
I am new to this forum, could any one help me out in resolving the below issue.
Input of the flat file contains several lines of text for example find below:
5022090,2,4,7154,88,,,,,4/1/2011 0:00,Z,L,2
5022090,3,1,6648,88,,,,,4/1/2011 0:00,Z,,1... (0 Replies)
Hi Friends,
I want to convert a XML file to flat file.
Sample I/p:
<?xml version='1.0' encoding='UTF-8' ?>
<DataFile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' contactCount='4999' date='2012-04-14' time='22:00:14' xsi:noNamespaceSchemaLocation='gen
.xsd'>
<Contact... (3 Replies)
hi
i have written a script for reading a csv file and creating a flat file, suggest if this script can be optimized
#----------------
FILENAME="$1"
SCRIPT=$(basename $0)
#-----------------------------------------//
function usage
{
echo "\nUSAGE: $THIS_SCRIPT file_to_process\n"... (3 Replies)
Discussion started by: mprakasheee
3 Replies
LEARN ABOUT HPUX
nl
nl(1) General Commands Manual nl(1)NAME
nl - line numbering filter
SYNOPSIS
type] type] type] start#] incr] sep] width] format] num] delim] [file]
DESCRIPTION
reads lines from the named file or the standard input if no file is named and reproduces the lines on the standard output. Lines are num-
bered on the left in accordance with the command options in effect.
views the text it reads in terms of logical pages. Line numbering is reset at the start of each logical page. A logical page consists of
a header, a body, and a footer section. Empty sections are valid. Different line numbering options are independently available for
header, body, and footer (e.g., no numbering of header and footer lines while numbering blank lines only in the body).
The start of logical page sections are signaled by input lines containing nothing but the following delimiter character(s):
|
Line contents | Start of
--------------+----------
::: | header
:: | body
: | footer
Unless told otherwise, assumes the text being read is in a single logical page body.
Command options can appear in any order and can be intermingled with an optional file name. Only one file can be named. recognizes the
following options:
Specifies which logical page body lines are to be numbered.
Recognized types and their meanings are:
number all lines;
number lines with printable text only;
no line numbering;
number only lines that contain the regular expression
specified in string. Basic Regular Expression syntax is supported (see regexp(5)).
The default type for logical page body is (text lines numbered).
Same as except for header. Default type for logical page header is (no lines numbered).
Same as except for footer. Default for logical page footer is (no lines numbered).
Do not restart numbering at logical page delimiters.
start# is the initial value used to number logical page lines. Default is
incr is the increment value used to number logical page lines. Default is
sep is the character or characters used in separating the line number and the corresponding text line. Default sep is a
tab.
width is the number of character columns to be used for the line number. Default width is
format is the line numbering format. Recognized values are:
left justified, leading zeroes
suppressed;
right justified,
leading zeroes suppressed;
right justified, leading zeroes kept.
Default format is (right justified).
num is the number of consecutive blank lines to be treated and numbered as a single line. For example, results in every
third adjacent blank line being numbered if the appropriate and/or option is set. Default is
The delimiter characters specifying the start of a logical page
section can be changed from the default characters to two user-specified characters. If only one character is entered,
the second character remains the default character No space should appear between the and the delimiter characters, how-
ever, this restriction is not there for (see standards(5)) compliant To define a backslash as the delimiter, use two
backslashes.
EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5).
Environment Variables
determines the collating sequence used in evaluating regular expressions.
determines the characters matched by character class expressions in regular expressions.
If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty
variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of
If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single-byte character code sets are supported.
EXAMPLES
Number starting at line number 10, using an increment of ten. The logical page delimiters are and
SEE ALSO pr(1), environ(5), lang(5), regexp(5), standards(5).
STANDARDS CONFORMANCE nl(1)