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','Pteronarcidae''Pteronarcella' >