按“最后修改文件”的顺序列出列表文件中的文件

按“最后修改文件”的顺序列出列表文件中的文件

如果我这样做,ls -ltrd *我可以列出按修改时间顺序排序的文件或目录(由于有选项,最近的文件在最后r)。现在我有一个包含此类文件或目录列表的文件,如下所示(顺便说一下,此列表仅包含文件)。假设这是文件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

我想按修改时间的反向顺序列出这些文件。我该怎么做?我试过

ls -ltrd < cat list

但它给了我

bash: cat: No such file or directory

或者当我尝试

ls -ltrd < `cat list.txt`

它给了我

bash: `cat list.txt`: ambiguous redirect

我该怎么做?

答案1

我找到了这个将文件内容通过管道传输到 ls以下是我的回答:

xargs ls -ltrd < list.txt

相关内容