【发布时间】:2016-04-08 02:09:44
【问题描述】:
我需要从一个单词中删除字母 X: 例如:我需要把星球大战的第一个字母,慕尼黑的第四个字母,...
1 star wars
4 munich
5 casino royale
7 the fast and the furious
52 a fish called wanda
到
tar wars
munch
casio royale
the fat and the furious
a fish called wanda
我已经用 cut 试过了,但是没有用。
这是我的命令:
sed 's/^\([0-9]*\) \(.*\)/ echo \2 | cut -c \1/'
所以它给了我这个输出:
echo star wars | cut -c 5
echo munich | cut -c 5
echo casino royale | cut -c 5
echo the fast and the furious | cut -c 5
echo a fish called wanda | cut -c 52
如果我将它发送到 bash。我只得到单词的第 X 个字母。
我需要使用 sed 和其他命令进行练习。但我不能使用 awk 或 perl。
谢谢
【问题讨论】: