0
我一直使用的命令是“ls -lR”。结果通常如下所示:在UNIX中递归地列出子目录中的文件名和时间戳
.:
total 4
lrwxrwxrwx 1 root root 9 Oct 11 03:35 dos -> /root/dos
drwxr-xr-x 2 root root 80 Oct 11 03:35 folder1
drwxr-xr-x 2 root root 100 Oct 11 03:35 folder2
-rw-r--r-- 1 root root 242 Oct 11 03:35 hello.c
./folder1:
total 0
-rw-r--r-- 1 root root 0 Oct 11 03:25 file1001
-rw-r--r-- 1 root root 0 Oct 11 03:35 file1002
./folder2:
total 0
-rw-r--r-- 1 root root 0 Oct 11 03:39 file2001
-rw-r--r-- 1 root root 0 Oct 11 03:45 file2002
如何优化命令以便它只显示以下内容?
./folder1:
Oct 11 03:25 | file1001
Oct 11 03:35 | file1002
./folder2:
Oct 11 03:39 | file2001
Oct 11 03:45 | file2002
是否可以在时间戳和文件名之间添加分隔符(例如|)?此外,我还想排除根文件夹中的文件(即只显示子文件夹的内容。谢谢! – Afungus
是的,但你会想要看看sed/awk - 都可以做分隔符,并且sed可以在根文件夹之后的文件夹中找到唯一的东西,但这是一个比我在评论中可以解释的教程长得多的教程,并且语法是一个令人头痛的问题。 – bubthegreat