I've got a number of .dat files (variable) with 2 pieces of information in them each, a weight and a height, space delimited like the following where First_Last is a name:
18kg 1.2m in "First1_Last1.dat"
12kg 1.6m in "First2_Last2.dat" etc.
I need to sort them by either the first or second value in each. I'm thinking the I have to
cat and combine all the files, strip the units out with a
cut (not so sure on that), then add the filenames as a third column using
paste and finally
sort -k 1,1 temp.txt on my temporary file to get my desired output while still being able to keep track of which file each value came from because I need the associated names to open a different file for each person in the correct order after. So my output file I would use would look something like
12 1.6 First2_Last2.dat 18 1.2 First1_Last1.dat
I'm wondering if there is a better way to do this using something built in or a property of the .dat file type I'm missing. Or maybe using