Problem with sorting script - two column sort (Solved)

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
ally
Posts: 1957
Joined: Sat 19 May 2012, 19:29
Location: lincoln, uk
Contact:

#16 Post by ally »


User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#17 Post by Flash »

Hansol and musher0, you two ought to collaborate on a thread about an Enterprise Puppy in the How-to section of the forum. :)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#18 Post by musher0 »

Flash wrote:Hansol and musher0, you two ought to collaborate on a thread about an Enterprise Puppy in the How-to section of the forum. :)
Thanks for the thought, Flash.

Indeed, it would certainly be very good to have hansol and his expertise on board.
For the last couple of days, Eric (e_mattis) and I have started to exchange seed ideas
about a new SOHO Puppy, through PM.

Maybe considering an "Enterprise Puppy" is a bit ambitious at this point, but with
like-minded people working together in some sort of loose team structure, who knows,
anything's possible.

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#19 Post by Karl Godt »

hansol wrote:Musher,

Thanks very much! That certainly got it sorted out. I'm staring at your code trying to figure out "why" it works, and can't quite grasp it, but all I care about is that it does indeed work! :D

You saved me hours of googling, so thanks again.
First :
Your code had two times the -k switch
The -k switch is commonly used together with the -t switch :

Code: Select all

LIST="101  A
101  B
101  C
102  A
102  B
102  C
103  A
103  B
103  C"

sortDELIMITER=" "

echo "$LIST" | sort -k2 -t"$sortDELIMITER"
101  A
102  A
103  A
101  B
102  B
103  B
101  C
102  C
103  C
And be aware that Puppies might use the busybox sort applet instead of the binary :

Code: Select all

LIST="101  A                              
101  b
101  C
102  A
102  b
102  C
103  a
103  B
103  c"

echo "$LIST" | sort -k2 -t"$sortDELIMITER"
103  a
101  A
102  A
101  b
102  b
103  B
103  c
101  C
102  C

echo "$LIST" | busybox sort -k2 -t"$sortDELIMITER"
101  A
102  A
103  B
101  C
102  C
103  a
101  b
102  b
103  c

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#20 Post by disciple »

Interesting thread.
Hansol, you might also want to check out pdfshuffler and pdfsam if you haven't already. And one day you might find Kingsoft Office or perhaps Softmaker Office saves you from Wine :)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Post Reply