Splitting a file from specific column content
python.list at tim.thechases.com
Sun Jan 22 14:25:03 EST 2012
On 01/22/12 08:45, Roy Smith wrote:
> I would do this with standard unix tools:
> grep '^' input.txt> first-three-seconds.txt
> grep '^' input.txt> next-two-seconds.txt
> grep '^' input.txt> next-three-seconds.txt
> Sure, it makes three passes over the data, but for 20 MB of data, you
> could have the whole job done in less time than it took me to type this.
If you wanted to do it in one pass using standard unix tools, you
sed -n -e'/^[0-2]/w first-three.txt' -e'/^/w next-two.txt'
More information about the Python-list