in reply to cat -ing Multiple files with Perl
The first is simply a replacement for DOS or other systems which don't provide a cat command.
perl -p file1 file3 file14 file47 > selected.txt
The second lets you list the files to be selected in a file. Instead of listing them all, one by one, you cat the file into the command list for the perl command.
perl -p `cat selection.list` > selected.txt
If you are concatenating many files, being the restrictions of command line length, the third one uses a begin block to open the file, stuff all the names into @ARGV, replacing whatever was there before ( namely the name of the section file ), and lets the -p option output print all the files.
perl -p -e'BEGIN{ local $/; open LIST, '<', $ARGV[0]; my @list = <LIST +>; @ARGV = @list; }' selection.list > selected.txt
--
TTTATCGGTCGTTATATAGATGTTTGCA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: cat -ing Multiple files with Perl
by Anonymous Monk on Aug 29, 2009 at 11:24 UTC |