Where the input file (sorted text file) is mycsv.csv .perl -naF, -e '$F[0] eq $prev or close FIL,open FIL,qq|>>|, $F[0] . q +q|.txt|;print FIL $_;$prev=$F[0]' mycsv.csv
If you are on Windows, use double-quotes instead of single.
Update: Changed OPEN to APPEND instead of overwrite, which seems to be what the OP wants.
..to maintain is to slowly feel your soul, sanity and sentience ebb away as you become one with the Evil.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Aggregating Lines from a CSV who lines match a particular field and save those matches based on that matching field name
by ikegami (Patriarch) on Dec 10, 2008 at 06:19 UTC | |
by Knoperl (Acolyte) on Dec 10, 2008 at 23:04 UTC |