|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
sort excluding first line [heading line]
Hi,
My data file has a header line as the first line. I want to do a sort on this file but header line being retained as it is. Any direct way of doing this? Of course I can do head -1 dummy.txt > sort_dummy.txt tail +2 dummy.txt | sort -u >> sort_dummy.txt But is there a more drect way of doing this [May be any sort option, etc] Thanks, Sunil |
|
#2
|
|||
|
|||
|
NO, what you could do, open the ouput file ONCE
note the brakets! Code:
( head -1 ${in:=dummy.txt} ; tail +2 $in | sort -u )> sort_$in
in vi, you can say Code:
:2,$!sort -u and you can start vi in not interactive mode ![]() Last edited by guggach : September 16th, 2004 at 04:41 AM. Reason: typo |
|
#3
|
|||
|
|||
|
optimized thanks
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > sort excluding first line [heading line] |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|