Re: [PLUG] sort option for 'natural' sequence

2020-03-31 Thread Rich Shepard
On Tue, 31 Mar 2020, Paul Heinlein wrote: OK, that was too snarky to be helpful. Paul, Nah, snarky's okay in today's world. :-) GNU sort has a couple different options for this sort of thing. The -n option does a basic numeric sort. It works fine on a list of basic numbers. And that was m

Re: [PLUG] sort option for 'natural' sequence

2020-03-31 Thread Paul Heinlein
On Tue, 31 Mar 2020, Paul Heinlein wrote: On Tue, 31 Mar 2020, tomas.kuchta.li...@gmail.com wrote: Everyone has different toolbox and regexp logic wired in their brains. I prefer to break things down somewhat step by step - and think ahead - mostly it is worth it. I'm just the opposite; us

Re: [PLUG] sort option for 'natural' sequence

2020-03-31 Thread Paul Heinlein
On Tue, 31 Mar 2020, tomas.kuchta.li...@gmail.com wrote: Everyone has different toolbox and regexp logic wired in their brains. I prefer to break things down somewhat step by step - and think ahead - mostly it is worth it. I'm just the opposite; use the simple tool: -V option to GNU sort. [ba

Re: [PLUG] sort option for 'natural' sequence

2020-03-30 Thread tomas . kuchta . lists
Everyone has different toolbox and regexp logic wired in their brains. I prefer to break things down somewhat step by step - and think ahead - mostly it is worth it. The following is more complex at first, but, in my experience, as soon as you sort by the first column - I would probably need to so

Re: [PLUG] sort option for 'natural' sequence

2020-03-30 Thread Reid
You can use a variation the "Decorate, Sort, Undecorate (DSU)" idiom (as documented in `info sort`). $ awk -F, '{print length($1), $0}' sample.dat | sort -n | cut -f2- -d' ' Sent with ProtonMail Secure Email. ‐‐‐ Original Message ‐‐‐ On Monday, March 30, 2020 4:30 PM, Rich Shepard wr

Re: [PLUG] sort option for 'natural' sequence

2020-03-30 Thread J. Hart
try this : cat sample.dat | sed "s|^'\([0-9]*\)'|\1 '\1'|" | sort -n | sed "s|^[0-9]* ||" | tee sample.dat.new On 03/31/2020 08:30 AM, Rich Shepard wrote: sample.dat: '648',17,'2011-07-11','Insecta','Plecoptera','Chloroperlidae''Suwallia' '652',17,'2011-07-11','Insecta','Plecoptera','Pteron

[PLUG] sort option for 'natural' sequence

2020-03-30 Thread Rich Shepard
sample.dat: '648',17,'2011-07-11','Insecta','Plecoptera','Chloroperlidae''Suwallia' '652',17,'2011-07-11','Insecta','Plecoptera','Pteronarcidae''Pteronarcella' '895',17,'2010-09-13','Insecta','Ephemeroptera','Baetidae''Baetis' '899',17,'2010-09-13','Insecta','Diptera','Psychodidae''Pericoma' '901