如何删除在bash一个字符后的所有文字? [英] How can I remove all text after a character in bash?
本文介绍了如何删除在bash一个字符后的所有文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样可以删除所有文本字符后,在这种情况下,一个冒号(:),在bash?我可以删除冒号,也?我不知道怎么样。
How can I remove all text after a character, in this case a colon (":"), in bash? Can I remove the colon, too? I have no idea how to.
推荐答案
一个例子可能是有益的,但如果我理解正确的你,这会工作:
An example might have been useful, but if I understood you correctly, this would work:
cut -f1 -d":"
这将转换成你好:天下到你好。
This will convert "hello: world" into "hello".
这篇关于如何删除在bash一个字符后的所有文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文