awk + cut file between lines from ext ARG

2

I have the following awk commnad I want to cut the file from start to end please advice why awk not work

   awk -v PARAM=start -v PARAM1=end '/PARAM/,/PARAM1/' file

file:

2324
443
start
43
end
545

required file

start
43
end

jennifer

Posted 2010-11-03T09:13:53.203

Reputation: 897

Answers

1

You can't use variables between slashes. Use the match operator ~ or the equality operator ==:

awk -v PARAM=start -v PARAM1=end '$0 ~ PARAM,$0 ~ PARAM1' file

or

awk -v PARAM=start -v PARAM1=end '$0 == PARAM,$0 == PARAM1' file

Paused until further notice.

Posted 2010-11-03T09:13:53.203

Reputation: 86 075