这个正则表达该怎么写(shell)
-rwxr-xr-x 1 root root 30520637 Wed Jul 11 16:20:32 2012 MANU_2012-07-11_16-18-24[0].Mp4*
-rwxr-xr-x 1 root root 13359690 Wed Jul 11 16:21:36 2012 MANU_2012-07-11_16-20-42[0].Mp4*
-rwxr-xr-x 1 root root 138668923 Wed Jul 11 16:37:48 2012 MANU_2012-07-11_16-27-50[0].Mp4*
-rwxr-xr-x 1 root root 47028033 Wed Jul 11 16:41:14 2012 MANU_2012-07-11_16-37-49[0].Mp4*
向通过过滤把字符行变成:
Jul 11 16:20:32 2012 MANU_2012-07-11_16-18-24[0].Mp4
Jul 11 16:21:36 2012 MANU_2012-07-11_16-20-42[0].Mp4
那位大侠指点一下,谢谢。
[解决办法]
写不写入文件有区别吗?要写入文件就加一个文件重定向嘛:
[nicenight@CSDN ~]$ cat lll.txt -rwxr-xr-x 1 root root 30520637 Wed Jul 11 16:20:32 2012 MANU_2012-07-11_16-18-24[0].Mp4*-rwxr-xr-x 1 root root 13359690 Wed Jul 11 16:21:36 2012 MANU_2012-07-11_16-20-42[0].Mp4*-rwxr-xr-x 1 root root 138668923 Wed Jul 11 16:37:48 2012 MANU_2012-07-11_16-27-50[0].Mp4*-rwxr-xr-x 1 root root 47028033 Wed Jul 11 16:41:14 2012 MANU_2012-07-11_16-37-49[0].Mp4*[nicenight@CSDN ~]$ cat lll.txt | tr -d '*' | cut -d' ' -f7-Jul 11 16:20:32 2012 MANU_2012-07-11_16-18-24[0].Mp4Jul 11 16:21:36 2012 MANU_2012-07-11_16-20-42[0].Mp4Jul 11 16:37:48 2012 MANU_2012-07-11_16-27-50[0].Mp4Jul 11 16:41:14 2012 MANU_2012-07-11_16-37-49[0].Mp4
[解决办法]
论坛不稳定啊,一下就弄了三个回复,来个正则的,等一晚上没人回复,那就弄个小号来回复了:
[nicenight@CSDN ~]$ cat lll.txt | sed -r 's/(.*Wed |\*)//g'Jul 11 16:20:32 2012 MANU_2012-07-11_16-18-24[0].Mp4Jul 11 16:21:36 2012 MANU_2012-07-11_16-20-42[0].Mp4Jul 11 16:37:48 2012 MANU_2012-07-11_16-27-50[0].Mp4Jul 11 16:41:14 2012 MANU_2012-07-11_16-37-49[0].Mp4