|P is for Practical|
Re^4: selecting columns from a tab-separated-values fileby Lotus1 (Chaplain)
|on Jan 22, 2013 at 04:35 UTC||Need Help??|
You can't reorder the output fields with 'cut'
Isn't that what I just said? Maybe you intended to reply to mildside.
...if you have 'sed' you can do this...
I have sed but I prefer Perl.
update: So I couldn't resist trying this sed command and found that it works for the input provided but as soon as you add more fields at the end it breaks.
Given this input file:
You get this output:
The greedy '.*' regex expressions cause the regex engine to match from the right and work back. '\1' ends up holding everything on the left that remains unmatched. For the first line \1 holds FIRST MIDDLE LAST STRNO CITY .
Here is a version that works.