David Kastrup <[email protected]> writes:
> moonhkt <[email protected]> writes:
>
>> On Jan 21, 10:00 pm, Barry Margolin <[email protected]> wrote:
>>> In article
>>> <fda30a91-58d9-4a6c-9b1d-b229c8a66...@t35g2000yqj.googlegroups.com>,
>>>
>>>
>>>
>>> moonhkt <[email protected]> wrote:
>>> > How to sort file without sort first line or first two lines ?
>>>
>>> > Text file as below
>>> > MTH NUM
>>> > JAN A 1
>>> > APR C
>>> > FEB B 1
>>> > MAR D 1
>>>
>>> > Expect Output
>>> > MTH NUM
>>> > JAN A 1
>>> > FEB B 1
>>> > APR C
>>> > MAR D 1
>>>
>>> { head -1 file; tail -2 file | sort +k 2; } > sortedfile
>>>
>>
>> Tried, Not worked.
>
> You'll need tail -n +2 file here.
Or do something like
cat file | { IFS="" read -r x; echo "$x"; sort +k 2; } >sortedfile
--
David Kastrup
_______________________________________________
gnu-misc-discuss mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnu-misc-discuss