Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert header into a file 1

Status
Not open for further replies.

mwesticle

Programmer
Nov 19, 2003
51
0
0
US
Very easy question here:

I have a file that contains pipe-delimited data.
I need to insert a header record, without overwriting any data records. So, if the input file looks like this:

John Doe|123 Main St|New York|NY|10101
Jane Doe|456 Oak St|Chicago|IL|12345

I need the output file to contain this record:

Name|Address|City|State|Zip

So, the ouput file will look like this:

Name|Address|City|State|Zip
John Doe|123 Main St|New York|NY|10101
Jane Doe|456 Oak St|Chicago|IL|12345

Can I use nawk for this task? Or what do you think???
Thanks to all!
 
( echo 'Name|Address|City|State|Zip'; cat myFile.txt) > myNEWfile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top