[NTLUG:Discuss] Sort question
Fred James
fredjame at fredjame.cnc.net
Thu Apr 5 19:39:25 CDT 2012
Chris Cox wrote:
> first tr should be '[0-9]' get rid of the carat
>
>
>> Chris Cox wrote:
>>
>>> My soln in bourne shell script:
>>> #!/bin/sh
>>> while read line;do
>>> echo "$line" | tr -cs '[^0-9]' '\012' | sort -n | tr '\012' ' '
>>> echo ""
>>> done
>>>
>>> To use: sh thescript.sh <thedatafile
>>>
>>>
>>>
>> Very nice
>> Regards
>> Fred James
>>
Chris Cox
I had wondered about the carat ... but it works in either case ...
¿Por qué, me pregunto?
For those unfamiliar ...
man tr
man sort
man ascii (i.e., '\012' is octal for newline)
Regards
Fred James
More information about the Discuss
mailing list