【发布时间】:2012-11-15 19:41:19
【问题描述】:
我有一个大的日志文件,我需要从中提取文件名。
文件如下所示:
/path/to/loremIpsumDolor.sit /more/text/here/notAlways/theSame/here
/path/to/anotherFile.ext /more/text/here/differentText/here
.... about 10 million times
我需要像这样提取文件名:
loremIpsumDolor.sit
anotherFile.ext
我认为我的第一个策略是用 '' 查找/替换所有 /path/to/。但我不知道如何删除空格后的所有字符。
你能帮忙吗?
【问题讨论】:
标签: regex string bash shell text-manipulation