I have to grab the first two lines, the lines 43 and 44, and the last 2 lines from a file in one conduct of commands.
Is there away to print those while only using head, tail and pipe commands AND without special operators like && or ;?
All I could think of is this
(cat cool | head -n 2) | (tail -n +43 | head -n 2) | (tail -n 2)
but it has cat...
AND another option is
(head -n 2 < cool) | (tail -n +43 < cool | head -n 2) | (tail -n 2 < cool)
but for some reason it only shows the last line
Asked by cow
(81 rep)
Oct 17, 2023, 03:17 PM
Last activity: Oct 17, 2023, 07:58 PM
Last activity: Oct 17, 2023, 07:58 PM