Jan Burdil said:
And I need to sort lines from curl command.
curl ftp://1.1.1.1 give me
-rw-r--r-- 1 honza users 414 Sep 22 12:16 curl.txt
-rwx------ 1 honza users 52 May 31 21:54 bb
drwx------ 2 honza users 512 Aug 22 10:54 mail
And I would like the result to be sorted by date. [...]
like this
perl -e 'print join "\n", sort { -M $b <=> -M $a } `curl
ftp://1.1.1.1`,"\n"'
[...]
You need to arrange for $a and $b to contain filenames,
How would this help? He needs to sort lines which contain a text
representation of a date by this date. -M doesn't do that, so he
shouldn't use -M but extract the date from each line and convert it to a
comparable value (e.g., seconds since the epoch, or yyyy-mm-ddThh:mm).
HTTP:

ate may be helpful.
Another way might be to ditch curl in favour of Net::FTP. I haven't
looked at it, but I expect it to contain a function to parse directory
listings from FTP servers.
hp