在UNIX中删除字符串的第n个字符

时间:2016-01-04 12:53:38

标签: bash unix sed mint

给出以下文本文件:

1 star wars
4 munich
5 casino royale
7 the fast and the furious
52 a fish called wanda

每一行都以一个数字开头,这个数字表示我要在单词旁边的句子中删除的第n个字符。 输出应为:

tar wars
munch
casio royale
the fat and furious
a fish called wanda

我想做这样的事情:

cat numberFile.txt | sed "s/^\([0-9]\) \(.*\)$/echo \2 | sed 's/\w//\1/'/g"

但这显然不起作用。所以,如果有人知道如何。

0 个答案:

没有答案