例如,我可能想要:
tail -f logfile | grep org.springframework | <command to remove first N characters>
我在想tr
可能有能力做到这一点,但我不确定。
发布于 2009-06-09 19:06:44
使用cut
。例如:要剥离每行的前4个字符(即从第5个字符开始):
tail -f logfile | grep org.springframework | cut -c 5-
发布于 2015-07-06 16:24:03
您可以使用cut
:
cut -c N- file.txt > new_file.txt
-c:
字符
file.txt:
输入文件
new_file.txt:
输出文件
要剪切并输出到新文件的从N到结尾的N-:
字符。
还可以有其他参数,如:'N‘,'N-M','-M’分别表示第n个字符,第n个到第m个字符,第一个到第m个字符。
这将对输入文件的每一行执行操作。
发布于 2009-06-09 19:04:58
tail -f logfile | grep org.springframework | cut -c 900-
将删除前900个字符
cut
使用900-显示行尾的第900个字符
但是,当我通过grep传输所有这些内容时,我什么也得不到
https://stackoverflow.com/questions/971879
复制相似问题