删除一行前 N 个字符的 unix 命令是什么? [英] What is a unix command for deleting the first N characters of a line?

查看:19
本文介绍了删除一行前 N 个字符的 unix 命令是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我可能想:

tail -f logfile | grep org.springframework | <command to remove first N characters>

我认为 tr 可能有能力做到这一点,但我不确定.

I was thinking that tr might have the ability to do this but I'm not sure.

推荐答案

使用 cut.例如.去除每行的前 4 个字符(即从第 5 个字符开始):

Use cut. Eg. to strip the first 4 characters of each line (i.e. start on the 5th char):

tail -f logfile | grep org.springframework | cut -c 5-

这篇关于删除一行前 N 个字符的 unix 命令是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆