<分区>
虽然这将是一项简单的任务,但我遇到了一些麻烦。
示例输入
$ cat file.txt
Brown Potatoes with Cheese
Yellow Potatoes with Sugar and Cheese
我想使用 sed
删除字符串 with 之后的所有内容
所以输出是
Brown Potatoes
Yellow Potatoes
我试过这个正则表达式,但它似乎不起作用。
sed -i -e "s/with.*//g" file.txt
我哪里出错了?