【发布时间】:2016-05-21 07:57:41
【问题描述】:
256-56-8411 Bob 3.61 junior cs
471-44-7458 Tim 3.45 senior ce
326-56-4286 Rajesh 2.97 freshman te
548-66-1124 Eric 2.88 sophomore ee
447-21-3599 John 2.51 junior cs
911-41-1256 Rebecca 3.92 senior cs
854-22-6372 Robin 2.45 freshman te
此数据由制表符分隔。我需要编写一个 shell 命令,它只显示 ID 不以“4”开头的学生。
【问题讨论】:
-
我相信你会的。您的问题尽可能不具体,最重要的是,您没有表现出任何努力。您应该先解决这些问题,然后在遇到实际编码问题时回来询问。我们很乐意为此提供帮助。
-
我会用 sed 试试。
-
为什么要使用shell?使用像 php 这样的脚本语言将使这远更容易和更透明。
-
grep '^[^4]',打败它,sed!sed -n '/^[^4]/p'...呃! -
sed '/^4/d'工作得很好,sed /^4/d