![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| doubt in awk | jisha | Shell Programming and Scripting | 4 | 04-16-2008 01:02 AM |
| AWK doubt | Rafael.Buria | Shell Programming and Scripting | 2 | 02-06-2008 08:00 AM |
| doubt about awk | soujanya_srk | UNIX for Dummies Questions & Answers | 2 | 01-10-2008 02:26 PM |
| awk doubt.. | esham | Shell Programming and Scripting | 11 | 10-10-2007 11:24 PM |
| ftp doubt | ranj@chn | Shell Programming and Scripting | 0 | 01-04-2006 05:47 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I'm having a file with 5 fields.
I want to sort that file according to one field no 3. How shall I do using awk programming. Any input appreciatable. regards, vadivel.
__________________
vadivel.r |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
If you are asking how to sort a file on the 5th field, that's easy:
sort -k 5 < file I can certainly give you an example in awk too, but, be careful what you ask for.. ;-) - dEvNuL |
|
#3
|
|||
|
|||
|
Sort is not reliable for all fields.
Hi,
thanks for ur response. But that sort option is not working. My file is like, ABCD 2.03 0.00 123.00 0.00 ACB 0.00 25.00 0.00 123.23 ABVCERR[12] 0.00 456.00 98.00 0.00 like this I want to sort with the last field. As every field is of various length and 5 spaces between fields, I'm not able to use sort command like sort -t\ +3rn < file it is giving some garbage results. That's why I want an awk program which will be a secured one. Thanks for any input. Regards, vadivel. |
|
#4
|
||||
|
||||
|
Try "sort -k5n". I have tried it on your data and it worked for me.
|
|
#5
|
||||
|
||||
|
Remember, homework is not allowed in the forums. This looks like a homework problem to me
|
|
#6
|
|||
|
|||
|
I'm not a student.
Sorry,
I'm a programmer. I'm having the problem in extracting a report file. I dont want to give the exact information in the report file, so I gave an example. If it leads to a misunderstanding that I'm a student I feel sorry for that. Regards, vadivel. |
|
#7
|
|||
|
|||
|
Hi Perderabo,
I'm getting error message like, sort: option requires an argument -- k for the command sort -k5n < file It is suggesting that I've to give end field argument also. regards, vadivel |
|||
| Google The UNIX and Linux Forums |