在文本流删除第一个字 [英] Remove First Word in text stream

查看:104
本文介绍了在文本流删除第一个字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何从一个流中的文本的每一行删除第一个字?即

How would I remove the first word from each line of text in a stream? i.e.

$cat myfile 
some text 1
some text 2
some text 3

我要的是

$cat myfile | magiccommand 
text 1
text 2
text 3

我将如何去这个使用bash?我可以用awk'{打印$ 2 $ 3 $ 4 $ 5 ....}'但是这混乱的,会导致多余的空格对所有空参数。我在想,SED可能能够做到这一点,但我找不到任何的例子。任何帮助AP preciated!谢谢!

How would I go about this using bash? I could use awk '{print $2 $3 $4 $5 ....}' but that's messy and would result in extra spaces for all null arguments. I was thinking that sed might be able to do this, but I could not find any examples of this. Any help is appreciated! Thanks!

推荐答案

根据您的示例文本,

cut -d' ' -f2- yourFile

应该做的工作。

should do the job.

这篇关于在文本流删除第一个字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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