I am looking to combine all files in a directory (each having one column) into a single file with multiple columns. However, I need the files to be pasted by last modification time order, i.e. in the new file, the first column will come from the oldest file and the last column from the newest file.
I cannot change the names of the original files to reflect this time order. I have used the command raised and answered in this question but it doesn't quite do what I need because '*' is not intelligent to file time ordering.
paste * | column -s $'\t' -t > output.txt
--printf
that allows null termination, and recent versions of bash mapfile can read null delimited input - so you could make it handle files with newlines in that case, asmapfile -d '' -t files < <(stat --printf '%Y\t%n\0' * | sort -zn | cut -z -f 2-)
for example on suitably recent GNU-based systems – steeldriver Nov 04 '20 at 14:02