Mailing List Archive


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

Re: [tlug] How to sort the data



Hi

> On 12/6/06, John Joseph <johnjoseph.e@example.com>
> wrote:
> > I am interested in sorting a data and write them
> to different files.
> > Example of data set is given below:
> 
> A bit hard without the actual examples but you may
> want to check out
> the sort command. For example:
> 
> sort unsorted.txt > sorted.txt
> 
Sorry at the airport now so can`T test this 
(sort of pseudo code)

- Get the list (first word in list )
    cat file | awk '{print $1}' | sort -u > OUTFILE
- Wire a script
    #!/usr/local/bin/tcsh
    foreach ff(`cat OUTFILE`)
     echo "Grepping $ff"
     grep ^$ff OUTFILE > ${ff}.out
    end  

If multiple words , use egrep ( egrep XX\|YY OUTFILE)

some parts are syntax incorrect but u get the idea


g




 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links