Monday, February 8, 2010

Pick up lines with Perl

There are people who are good at saying or creating pick up lines and use them at bars, pubs and clubs.

Here a Perl 'one-liner' that will help process that 500mb text file (if you are doing bioinformatics, you might know what i am talking about)

If the file has columns separated by space, and you want to get the scores over a certain threshold and print that line to a file (also can be used $. to get the line number)

perl -ane 'if ($F[column_number] > score) {print $_}' filename.txt

if separated by something else

perl -F'symbol' -ane 'if ($F[column_number] > score) {print $_}' filename.txt

some more info

http://www.cbs.dtu.dk/courses/27619/lesson13.html