如何删除文本文件中第一个空格后每行中的所有字符?

Rya*_*yan 2 regex string bash shell text-manipulation

我有一个大型日志文件,我需要从中提取文件名.

该文件如下所示:

/path/to/loremIpsumDolor.sit /more/text/here/notAlways/theSame/here
/path/to/anotherFile.ext /more/text/here/differentText/here
.... about 10 million times
Run Code Online (Sandbox Code Playgroud)

我需要提取这样的文件名:

loremIpsumDolor.sit
anotherFile.ext
Run Code Online (Sandbox Code Playgroud)

我认为我的第一个策略是/path/to/用'' 找到/替换所有.但我坚持如何删除空格后的所有字符.

你能帮我吗?

Jon*_*ler 5

sed 's/ .*//' file
Run Code Online (Sandbox Code Playgroud)

它不再需要了.当然,转换后的输出出现在标准输出上.