本文介绍了如何在bash中删除字符串的第一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这段代码将给出第一部分,但是如何删除它,并获得没有第一部分的整个字符串呢?
This code will give the first part, but how to remove it, and get the whole string without the first part?
echo "first second third etc"|cut -d " " -f1 推荐答案您应该看一下信息剪切,它将解释 f1 的含义.另外,这里是一个相同的问题: question-7814205
You should have a look at info cut, which will explain what f1 means. Also, a same question here: question-7814205
实际上,我们只需要第二个字段之后的字段. -f 告诉命令按字段搜索,而 2-表示第二个和后续字段.
Actually we just need fields after(and) the second field. -f tells the command to search by field, and 2- means the second and following fields.
echo "first second third etc" | cut -d " " -f2-更多推荐
如何在bash中删除字符串的第一部分?
发布评论