Archive for August 2009

Stripping lines from a file, a quick perl one liner   Leave a comment

I’m getting bored of figuring this one out from first principles.

perl –n –e "if(!/^(SOMESTART|SOMEOTHERSTART)/) { print; }" filename.csv > smaller.csv

This is using the loop –n does, similar to the trick I’ve used with –p, it’s just that the –n doesn’t print automatically.  Instead I call print manually if a pattern is matched, or in this case, doesn’t match.

Posted August 11, 2009 by colinnewell in Programming

Tagged with

Follow

Get every new post delivered to your Inbox.

Join 37 other followers