On 6/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi all, > > Hopefully there is a way to do this... > > I have 2 unix flat files that I want to merge into 1 file. I know that I > can do something like "cat file1 file2 | sort -o newfile". The problem is > that once I have newfile loaded, I need to know where each line in newfile > came from. I am hoping that unix has something similar to the REUSE() > function so I can prefix each line with the filename. Here is an example of > what I would like to get done. >
Scott, There is probably a shorter way to do this using awk or sed but that awk man page is still stuck on my "things I should learn" list. A couple of simple bash shell only solutions would be as below. infile=file1 outfile=/tmp/mynewfile for i in `cat $infile` ; do echo "$infile*$i" >> $outfile done or while read i ; do echo "$infile*$i" >> $outfile done < $infile HTH Adrian ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/