![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to sort, and count unique data all at once? | amatuer_lee_3 | Shell Programming and Scripting | 16 | 04-14-2009 10:22 PM |
| how to read the data from an excel sheet and use those data as variable in the unix c | Anne Grace | UNIX for Advanced & Expert Users | 1 | 03-03-2008 07:21 AM |
| how to verify that copied data to remote system is identical with local data. | ynilesh | Shell Programming and Scripting | 3 | 01-31-2008 08:55 AM |
| Script to sort data | wizardy_maximus | Shell Programming and Scripting | 1 | 11-21-2007 04:30 AM |
| Howto capture data from rs232port andpull data into oracle database-9i automatically | boss | UNIX for Dummies Questions & Answers | 1 | 09-23-2007 02:35 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi!
I'm trying to sort a file.dat with the sort command. The data contained by file.dat is similar to the data set below: 100.000 99.000 110.000 55.000 113.000 33.000 25.000 9.000 15.000 It is relatively easy to sort the data in ascending or descending order, but the problem is that the separating empty rows between the blocks are put on top of the sorted file. I wish to keep the empty rows and sort the data blocks separately, like this: 99.000 100.000 110.000 33.000 55.000 113.000 9.000 15.000 25.000 Can anybody please help me? And also I must mention that I'm quite new at UNIX scripting, so try to explain in plain English ! bjorb |
|
||||
|
I'm too lazy
Hehe!
First of all I want to give my appreciation for a quick answer. Without knowing what the heck that code from Ygor meant I tested it in my script. It seemed to work partially in my case, but as a result of my own lazyness it did not give me the result I need. The data set is really in this format: 100.000 23.000 150.000 99.000 83.000 369.000 110.000 15.000 123.000 55.000 105.000 69.000 113.000 7.000 78.000 33.000 89.000 63.000 25.000 23.000 23.000 9.000 63.000 81.000 15.000 38.000 23.000 The columns represent x-, y- and z-coordinates. I wish to sort the columns with x- and y-coordinates in ascending order. Data is also supposed to be written back to data.dat I apologize for any inconvenience and humbly ask you to help me again. It is also in my interest to understand the prospective code which is given. Where can I get a good tutorial on gawk? Regards bjorb |
|
||||
|
Quote:
Code:
100.000 23.000 150.000 99.000 83.000 369.000 110.000 15.000 123.000 Code:
99.000 15.000 159.000 100.000 23.000 369.000 110.000 83.000 123.000 |
|
||||
|
simplified needs
After reviewing my needs I have realized that it would be sufficient to sort the data only considering the column with the y-coordinates:
From 100.000 23.000 150.000 99.000 83.000 369.000 110.000 15.000 123.000 to 110.000 15.000 123.000 100.000 23.000 150.000 99.000 83.000 369.000 How can I do this? Regards bjorb Last edited by bjorb; 09-15-2005 at 08:04 AM.. Reason: Forgot to actually ask for help... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|