UNIX shell 命令和管道的初学者问题
这是课程中的材料。根据我的研究,代码总是以 shebang 开头
#! /bin/sh
,我还想解决这个问题,我可能需要使用
wc, tail, grep, head
但我无法将它们放在一起。非常感谢您的帮助。
Write a shell command that processes a file
that is 200 lines long or more. It outputs the number of those lines within lines 100 through
199 *inclusive* that contain the character string “hello”.
Write a shell command that outputs the number of lines in the lines range
100..199 that contain "hello, " but is NOT followed by "world".
this is material from a course. From my research the code will always begin with the shebang
#! /bin/sh
And I also figured to solve this I would probably need to use a combinations of
wc, tail, grep, head
But I am having trouble putting this together. Help would be much appreciated.
Write a shell command that processes a file
that is 200 lines long or more. It outputs the number of those lines within lines 100 through
199 *inclusive* that contain the character string “hello”.
Write a shell command that outputs the number of lines in the lines range
100..199 that contain "hello, " but is NOT followed by "world".
第一个任务
第二个任务
1st task
2nd task