Differences between revisions 2 and 3

Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
* -n loop over input  * -e enable expression
Line 7: Line 7:
* -l strip newlines on input, but print them out with output  * -n loop over input
Line 9: Line 9:
* -a enable autosplit, resulting in array @F  * -l strip newlines on input, but print them out with output

 * -a enable autosplit, resulting in array @F

For example, say you have a tab delimited file of oligo sequences, with id in the 4th column, and sequence in the 5th column, and you want to convert it to a fasta file:

{{{
perl -nale 'print ">$F[3]\n$F[4]"' inputfile.txt
}}}

Perl One Liners

  • -e enable expression
  • -n loop over input
  • -l strip newlines on input, but print them out with output
  • -a enable autosplit, resulting in array @F

For example, say you have a tab delimited file of oligo sequences, with id in the 4th column, and sequence in the 5th column, and you want to convert it to a fasta file:

perl -nale 'print ">$F[3]\n$F[4]"' inputfile.txt

PerlRun (last edited 2009-06-12 17:56:55 by ChrisSeidel)