sort with tab field separator
Nicholas Robinson
npr at bottlehall.co.uk
Sat Mar 22 21:38:46 UTC 2008
On Saturday 22 March 2008 21:18:11 Amadeus W.M. wrote:
> You would think specifying tab as a field separator for sort would work
> like this:
>
> cat file | sort -k 3 -t "\t"
>
> It doesn't:
>
> sort: multi-character tab `\\t'
>
>
> So after a little search and some trial and error I got this to work:
>
> cat file | sort -k 3 -t "`/bin/echo -e '\t'`"
>
>
> For my own curiosity, can someone please illuminate me as to why the
> first incantation does not work as expected? Is there a more natural way
> to specify \t other than echo?
Take the double quotes out in your first attempt. So command becomes
cat file | sort -k 3 -t \t
Nick
More information about the fedora-list
mailing list