Test file
I need another method printing the block between two regular expressions
where the entire code is in “{ }” brackets.
I was thinking something like this code that prints the line containing the first regex.
I can't use any statement outside the brackets like.
Thanks.
Code:
$cat testfile
a b c
1 2 3
begin line with first regex
block 1 11
between 2 12
regex 3 13
end line with last regex
4 5 6
blah blah
I need another method printing the block between two regular expressions
where the entire code is in “{ }” brackets.
I was thinking something like this code that prints the line containing the first regex.
Code:
awk '{if(/begin/) print }' testfile
I can't use any statement outside the brackets like.
Code:
awk '/begin/,/end/{print $0}' testfile