Noting that in this specific dataset, the "#" is essentially the record separator, we can add a dummy record at the top, and use some of the features of a flexible alternative sorting code msort.
Here is a demonstration script with results:
producing:
Note that the raw results -- file t1 -- has a beginning and ending line that should be removed, which is what the sed command does. The sorting mode is hybrid, a combination of alphabetic and numeric.
If you have any odd sorting requirements that the standard sort does not address, it may be useful to consider msort.
Some more information on msort:
Best wishes ... cheers, drl
I wrote script in bash which generates this report:
User1,admin,rep,User2,shell,path1,x1,r1
User2,admin,rep,User7,shell,path1,x1,r1
User3,admin,rep,User4,shell,path1,x1,r1
User4,admin,rep,User3,shell,path1,x1,r1
User5,admin,rep,User1,shell,path1,x1,r1
User6,admin,rep,User5,shell,path1,x1,r1... (6 Replies)
Hi Guys,
I need help in modifying a large text file containing more than 1-2 lakh rows of data using unix commands. I am quite new to the unix language
the text file contains data in a pipe delimited format
sdfsdfs
sdfsdfsd
START_ROW
sdfsd|sdfsdfsd|sdfsdfasdf|sdfsadf|sdfasdf... (9 Replies)
Hi pls help me out to short out this problem
rm PAB113_011.out
rm: PAB113_011.out: override protection 644 (yes/no)? n
If i give y it remove the file.
But i added the rm command as a part of ksh file and i tried to remove the file. Its not removing and the the file prompting as... (7 Replies)
Hello all -
I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
I have 2 files,
file01= 7 columns, row unknown (but few)
file02= 7 columns, row unknown (but many)
now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there
e.g.
file 01
James|0|50|25|10|50|30... (1 Reply)
Hi Experts,
I have a filelist collected from another server , now want to sort the output using date/time stamp filed.
- Filed 6, 7,8 are showing the date/time/stamp.
Here is the input:
#----------------------------------------------------------------------
-rw------- 1 root ... (3 Replies)
Hi I'm a UNIX awk and sed novice at best. I'm trying to creat a .csv file so it can be graphed in Excel. Tried various xargs, awk, sed and paste but just can't seem to get the data to line up. Not sure if this is beyond for a question in these forums. Any help would greatly be appreciated.
Have... (4 Replies)
Hi I would like to move the first 1000 rows of my file into an output file and then move the last 1000 rows into another output file.
Any help would be great
Thanks (6 Replies)
Hello!
I have a tab delimited file with values in three columns. Some values occur in all three columns, other values are present in only one or two columns. I would like to sort the file so that rows with no missing values come first, rows with one missing values come next, and rows with two... (9 Replies)