I have a question:
I have a lot of file named like
or10000.dat, or9100.dat, or100.dat, or3100.dat...
I want to deal with these files according to the
number in the name. So I want to deal with or100.dat
first and then or3100.dat and so on.
I used :
for i in `ls or*.dat | sort -n`;do ...
but the first one is or 10000.dat.
Is there an easy way to do that?
Thanks in advance!
Yes, this one works. But I don't know why even after I read
the man page of sort. There is no "-k.". Would you please
explain why this one works? thank you.
by the way I tried to use --debug, but I got unrecognized option '--debug'
You may have an outdated manual page, -k is the modern way to tell sort to sort on a column. -k 1 would tell it to start at the first column (and consider all the columns thereafter), -k 1,1 would tell it to consider only the first column, etc. The options for it are quite complex.