使用sed,你如何打印一行的第一个'N'字符? [英] Using sed, how do you print the first 'N' characters of a line?
本文介绍了使用sed,你如何打印一行的第一个'N'字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
grep -G'defn -test。*'OctaneFullTest.clj | sed ....
解决方案
不要使用sed,使用切割。
grep .... | cut -c 1-N
如果您必须使用sed:
grep ... | sed -e's / ^ \(。\ {12 \} \)。* / \ 1 /'
With sed, what is a one liner to print the first n characters. I am doing the following.
grep -G 'defn -test.*' OctaneFullTest.clj | sed ....
解决方案
Don't use sed, use cut.
grep .... | cut -c 1-N
If you MUST use sed:
grep ... | sed -e 's/^\(.\{12\}\).*/\1/'
这篇关于使用sed,你如何打印一行的第一个'N'字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文