venciso has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys, I have to files I want to merge. They look as follows
File1: Adam 1 2 3 Eve 4 5 6 File2: Adam 4 5 6 Eve 7 8 9
I want the output file to look like:
Adam 1 2 3 4 5 6 Eve 4 5 6 7 8 9
I know that you can add text to the end of each line of a file by using a command similar to:
perl -p -i.bak -w -e "BEGIN {@ARGV=<file.txt>} s/\z/text to add/g"But is there a way to do something like the above using text from file2?
I know if you use unix you can use grep or paste or something like that but I want to do this in Windows.
Also, I know a way to do it with a script using hashes but I have a feeling there is a one line command that can do it.
Thanks in advance for your help,
Victor
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Merging two files by command line
by JavaFan (Canon) on Aug 20, 2009 at 14:23 UTC | |
by venciso (Initiate) on Aug 20, 2009 at 14:56 UTC | |
by markkawika (Monk) on Aug 20, 2009 at 18:39 UTC | |
|
Re: Merging two files by command line
by Fletch (Bishop) on Aug 20, 2009 at 14:54 UTC | |
by markkawika (Monk) on Aug 20, 2009 at 18:29 UTC | |
by Fletch (Bishop) on Aug 20, 2009 at 19:14 UTC | |
by Anonymous Monk on Aug 21, 2009 at 00:00 UTC |