sort by column or specific order


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sort by column or specific order
# 1  
Old 06-04-2009
sort by column or specific order

Hi,

I need to sort it by column or need it in a specific order...

input is
=====
uid=shashi country= india region =0 ph=0
uid= jon region= asia ph= 12345 country=0
uid = man country= india ph=2222 region=0
uid= neera region= asia ph= 125 country=0

output should be

uid=shashi country= india region =0 ph=0
uid= jon country=0 region= asia ph= 12345
uid = man country= india region=0 ph=2222
uid= neera country=0 region= asia ph= 125
======

thanks in advance...
# 2  
Old 06-04-2009
what have you tried?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies

2. Shell Programming and Scripting

Help with sort alphabet on specific column

Input file: POL B7U6K8 Avian_reticuloendotheliosis_virus POLB B7Z1W5 Homo_sapiens POLB H9G5Y0 Anolis_carolinensis POLD1 Q642R8 Xenopus_laevis POLD2 H0YZC7 Taeniopygia_guttata POLD3 F1P540 Gallus_gallus POLDIP3 Q5F4B6 Gallus_gallus POLE2 E1C2T8 Gallus_gallus... (3 Replies)
Discussion started by: perl_beginner
3 Replies

3. Shell Programming and Scripting

Sort by specific order?

Hello all I was wondering if someone has an idea how to sort by a specific order, let's say by a specific alphabet containing only 4 letters like (d,s,a,p) instead of (a,b,c....z) ?? Cheers! (6 Replies)
Discussion started by: cabrao
6 Replies

4. Shell Programming and Scripting

Sort numeric order

Hi I am using this cat substitutionFeats.txt | gawk '{$0=gensub(/\t/,"blabla",1);print}' | gawk '{print length, $0}' | sort -n | sort -r and the "sort -n" command doesn't work as expected: it leads to a wrong ordering: 64 Adjustable cuffs 64 Abrasion- 64 Abrasion pas 647 Sanitized 647... (4 Replies)
Discussion started by: louisJ
4 Replies

5. Shell Programming and Scripting

comparing column of two different files and print the column from in order of 2nd file

Hi friends, My file is like: Second file is : I need to print the rows present in file one, but in order present in second file....I used while read gh;do awk ' $1=="' $gh'" {print >> FILENAME"output"} ' cat listoffirstfile done < secondfile but the output I am... (14 Replies)
Discussion started by: CAch
14 Replies

6. UNIX for Dummies Questions & Answers

How to sort a column based on numerical ascending order if it includes e-10?

I have a column of numbers in the following format: 1.722e-05 2.018e-05 2.548e-05 2.747e-05 7.897e-05 4.016e-05 4.613e-05 4.613e-05 5.151e-05 5.151e-05 5.151e-05 6.1e-05 6.254e-05 7.04e-05 7.12e-05 7.12e-05 (6 Replies)
Discussion started by: evelibertine
6 Replies

7. Shell Programming and Scripting

Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the... (3 Replies)
Discussion started by: patrick87
3 Replies

8. Shell Programming and Scripting

How to manipulate first column and reverse the line order in third and fourth column?

How to manipulate first column and reverse the line order in third and fourth column as follws? For example i have a original file like this: file1 0.00000000E+000 -1.17555359E-001 0.00000000E+000 2.00000000E-002 -1.17555359E-001 0.00000000E+000 ... (1 Reply)
Discussion started by: Max Well
1 Replies

9. Shell Programming and Scripting

SORT order in Unix

I am converting mainframes JCL to be used in shell on a one to one basis... when i use the sort command unix does ascii sort as a result which numbers are first followed by charecters in the Ascending sort ... but themainframes uses the EBCDIC as result gives the charecters followed by numbers in... (5 Replies)
Discussion started by: bourne
5 Replies

10. UNIX for Dummies Questions & Answers

Sort - original order .... Help

Hi all, I want to sort a file based on the number in the 9th column I've tried both of the following commands sort -k 9,9n file_to_sort.dat sort +8 -n file_to_sort.dat both resulting in the same output which does sort col 9 nummerically but it doesn't output the lines in the original... (2 Replies)
Discussion started by: olga
2 Replies
Login or Register to Ask a Question