Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] sorting data set -Help



On 12/6/06, John Joseph <johnjoseph.e@example.com> wrote:
I am a new linux user. Would like to sort the data set by selecting
rows containing different set of first few letters or words. Example
of data set is given below. Wondering how do I select and write
those rows statrting with "$TKACC"; "$TKGPP" and "$TKATT".
My data file is quite large size.
==============================================
$TKATT,-0307P, 0051R,284.2T,00*27
$TKACC, 1551600,     -28.8966,     -84.0000,04C6,057E,2945*43
$TKGPP,011547.00,3529.377014,N,13547.150285,E,2,08,1.1,8.885,M,,M,4,0672,1*52

# SNIP

I'm not sure if I have entirely understood your question, but here goes...

Do you want one file with the data sorted by the contents of the first
column or do you want three separates files?

If you want one large file then my previous post will be the way to
go. If you want three seperate files this may be what you are looking
for:

cat original_data.txt | grep '^\$TKACC' | sort > TKACC_data.txt
cat original_data.txt | grep '^\$TKATT' | sort > TKATT_data.txt
cat original_data.txt | grep '^\$TKGPP' | sort > TKGPP_data.txt

Check the man page for sort for any special sorting requirements you may have.

Regards, Keith


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links