in reply to command line perl reading from STDIN
cat input_file.fq | \ perl -ne '$s=<>;<>;<>;chomp($s);print length($s)."\n";' > output.txt
Just a stylistic note, but this can be restated as the following:
perl -ne '$s=<>;<>;<>;chomp($s);print length($s)."\n";' \ <input_file.fq >output.txt
Unless I'm dumping the contents of a file to the console, I don't use cat that much .. head, tail and less are handier.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: command line perl reading from STDIN
by perlhappy (Novice) on Jan 31, 2013 at 16:43 UTC | |
by choroba (Cardinal) on Jan 31, 2013 at 17:25 UTC | |
by perlhappy (Novice) on Jan 31, 2013 at 18:06 UTC | |
by BrowserUk (Patriarch) on Jan 31, 2013 at 18:24 UTC | |
by perlhappy (Novice) on Jan 31, 2013 at 18:58 UTC | |
| |
by tye (Sage) on Jan 31, 2013 at 19:11 UTC | |
by perlhappy (Novice) on Feb 01, 2013 at 14:54 UTC |
In Section
Seekers of Perl Wisdom