在文本流删除第一个字

编程入门 行业动态 更新时间:2024-10-19 09:46:00
本文介绍了在文本流删除第一个字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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.

更多推荐

在文本流删除第一个字

本文发布于:2023-11-13 00:37:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582926.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:个字   文本

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!