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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert headline in all files

Status
Not open for further replies.

tonivm

Technical User
Mar 2, 2006
64
ES
hi:
how could i add a headline that is into files to another files?
thanks in advance.
 
Something like this, if I understand your requirement:

Code:
awk '
        FILENAME==ARGV[1] { headline=$0 ; next }
        FNR==1 {
                newfilename=FILENAME ".new"
                print headline >> newfilename
        }
        { print >> newfilename }
' headline file1 file2

This assumes that headline is a file containing only one line.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top