We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I could come up with 3 solutions for this. Since most of us are in a learning phase, this may help in broadening the understanding of the language-
Remember "cut" for previous questions? You can change the delimiter to '\n', meaning that each field would now correspond to a line.
cut -d$'\n' -f12-22
Just like head, tail command exists which can print the last n lines of a file. So just pass the first 22 lines from head to tail via a pipe.
head -n 22| tail -n 11
I actually came up with this solution first since I didn't know about tail. Basically, take the first 22 lines (from head) and pass then to a counter which will ignore the first 11 lines and start printing from the 12th.
count=1
head -n 22|whileread line;doif[$count -ge 12];thenecho$line;fi;count=$(($count+1));done
Middle of a Text File
You are viewing a single comment's thread. Return to all comments →
I could come up with 3 solutions for this. Since most of us are in a learning phase, this may help in broadening the understanding of the language-
cut -d$'\n' -f12-22
Hope it helps!