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!

append file a to file b ?? 2

Status
Not open for further replies.

desanti

Programmer
Jul 9, 2004
51
US
Hi:is there a command that will let me append a file to another file after processing the first file?i assume that it will do one record(line at a time).I have checked the sed & awk book and see no append in AWK.thank you.
 
see no append in AWK
Which book ?
No explanation of the difference between print > and print >> ?
You may also do a man tee paying attention to the -a option.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV: I have sed & awk published by oreilly.In the index the only reference to append is "append command(see A command (sed)).P.S. this is the second edition.also,i had another post concerning the -F option in this book and cakiwi responded by citing pages in the same book which referenced
the -F command.however,in my post i had said that the only
way i could get the -F command to work was to use -F: after seeing the same used in the knoppix linux software.he intimated that i had set the FS to :I did not.the FS was
"\n" BUT would only work if -F: was used.i am confused and feel perhaps there are numerous versions of awk,nawk,gawk etc.i had written to the publisher and was told that there were numerous versions of awk????? Can you please tell me of a reliable version.i appreciated the 'man tee' advice but
am unable to utilize same any further embellishment?thank you.











 
If you just want to stick file b onto the end of file a, would this not work?

cat b >> a

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Could you do something like this?
Code:
BEGIN {f1 = ARGV[1]} #store first input filename
FILENAME == f1 {printf "%d: %s\n", NR, $0; next} # process first file
{print $0} # just print second file
 
a different take on mikevh's code:
Code:
FNR == NR {printf "%d: %s\n", NR, $0; next} # process first file
{print $0} # just print second file

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Mike: thanx for your input.I have to investigate further
because i am not in a unix mode.i am in a windows/dos mode
and it is PECULIAR.i used M.GAGNE linux via a cd and problems that i have in WIN98SE go away with linux.stay tuned!!
 
Any dos/window version of awk should honor the print >> syntax.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
vgersh99:thanx for your help.my problem is the WIN98SE/DOS
enviornment.With linux(knoppix) awk works better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top