删除最后一个 / 之前的所有文本和 : 之后的所有文本,并从列表中删除 :
Remove all text before last / and all text after : and remove the : from a list
name//name/20000_random_test.txt: No space left on device
这是我需要在文件中修改的一行示例,所有行都具有相同的模式,如下所示:
name//name/<nameoffile>: No space left on device
我尝试使用:
cat didnotmakeit.txt | sed 's|.*\\(.*\)||' > filestoupload.txt
和
sed 's|.*\\(.*\)||' didnotmakeit.txt > filestoupload.txt
但是其中 none 对文件没有任何影响。
一定数量的文件没有 t运行 转移到文件夹,因为它 运行 来自 space。我将列表复制并粘贴到一个文件中。
我需要去掉文件名前后的字符。这样,我将有一个列表,然后使用另一个命令,例如:
grep NAME_REGEXP /path/to/filenames.list | rsync -a --files-from - . remote.example.com:
请帮我删除这些不需要的字符。谢谢!
以下应该有效:
sed 's!.*/\([^:].*\):.*!!' didnotmakeit.txt
name//name/20000_random_test.txt: No space left on device
这是我需要在文件中修改的一行示例,所有行都具有相同的模式,如下所示:
name//name/<nameoffile>: No space left on device
我尝试使用:
cat didnotmakeit.txt | sed 's|.*\\(.*\)||' > filestoupload.txt
和
sed 's|.*\\(.*\)||' didnotmakeit.txt > filestoupload.txt
但是其中 none 对文件没有任何影响。
一定数量的文件没有 t运行 转移到文件夹,因为它 运行 来自 space。我将列表复制并粘贴到一个文件中。
我需要去掉文件名前后的字符。这样,我将有一个列表,然后使用另一个命令,例如:
grep NAME_REGEXP /path/to/filenames.list | rsync -a --files-from - . remote.example.com:
请帮我删除这些不需要的字符。谢谢!
以下应该有效:
sed 's!.*/\([^:].*\):.*!!' didnotmakeit.txt