Consider text.txt
with this content:
blablabla
&&&key word&&&
I want all
these text and numbers 123
and chars !"£$%&
as output
&&&key word&&&
blablabla
I want to implement a regular Expressions with awk
which obtain following output:
I want all
these text and numbers 123
and chars !"£$%&
as output
I am using this expression:
awk "$1 ~ /^[&&&key word&&&].[&&&key word&&&]/" test.txt
but the result is not what I expect:
&&&key word&&&
&&&key word&&&
I apologize because maybe it is not a good question. I already tried many solutions from here and stackoverflow, I read some tutorials but still not able to solve it. If you can also give me a complete tutorial for this topic, I will be very thankful.
Edit: With $0 as advised, I get much better result:
awk "$0 ~ /[&&&key word&&&]/,/[&&&key word&&&]/" test.txt
results in:
&&&key word&&&
I want all
these text and numbers 123
and chars !"£$%&
as result
&&&key word&&&
I still need to remove first and last line, I know if condition like awk "{if (NR!=1&&NR!=-1) {print}}" text.txt
but I dont know how can I apply it on the output of above