文件
plym fury 77 73 2500
chevy nova 79 60 3000
ford mustang 65 45 17000
volvo gl 78 102 9850
ford ltd 83 15 10500
Chevy nova 80 50 3500
fiat 600 65 115 450
honda accord 81 30 6000
ford thundbd 84 10 17000
toyota tercel 82 180 750
chevy impala 65 85 1550
ford bronco 83 25 9525
我必须删除所有 10,000 美元或更多的汽车(文件中的最后一列)。我必须将排序的输出通过管道传输到 sed 来执行此操作,方法是在表示 5 位或更多位的正则表达式在记录末尾匹配时退出。
这是我必须管道的命令:grep -iv chevy cars | sort -nk 5
到目前为止我尝试过:
grep -iv chevy cars | sort -nk 5 | sed -n '/[0-9]{5}*/'
但无济于事。
So far we have:
grep -iv chevy cars | sort -nk 5
Now let's delete the cars that are $10,000 or more. Pipe the output of the sort into
a sed to do this, by quitting as soon as we match a regular expression representing 5
(or more) digits at the end of a record (DO NOT use repetition for this):
You entered: grep -iv chevy cars | sort -nk 5 | sed -n '/[0-9]{5}$/'
Please try again.