I have this set of commands:
grep -n '*' file.txt | head -n1 | awk -F\: '{print $1-1;}'
This tells me the previous line in which it first detects asterisks. Now I want to get the previous lines so that:
head -n<that previous line number>
The head requires a number immediately following the -n argument with no spaces, for example:
head -n4
How can i do this? He simply will not agree to add
| head -n
at the end of the instruction set. My searches were fruitless. Thanks!
David source
share