If I do ls -ltrd *
I can list the files or directories sorted in the modified time order (recent ones at the end, because of the r
option). Now I have a file containing list of this files or directories like this (by the way this list contains only files). Suppose this is the file list.txt
.
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/aa
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/ab_file_o.dat
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/bpad_40930.err
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/cds.lib
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/doctags
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/doctags_sw
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/env1
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/hdl.var
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/inc_list.txt
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/logx
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/makefileslist
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/scp_fw/abts.bin
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/sim_cmd.txt
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/sim_cmd/sim_cmd_defines.tcl
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/sim_cmd/sim_cmd_gui_fpga.tcl
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/src_list.txt
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/tags_sw
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/xemis_inc_list.txt
simab21m/sim_rtl_xmm_gemm_f32_spm_test_fpga/xemis_src_list.txt
I want to list up these files in reverse modified time order. How should I do it? I have tried
ls -ltrd < cat list
but it gives me
bash: cat: No such file or directory
or when I tried
ls -ltrd < `cat list.txt`
it gives me
bash: `cat list.txt`: ambiguous redirect
How should I do it?
I found this piping-the-contents-of-a-file-to-ls and here is my answer:
xargs ls -ltrd < list.txt