IKeystone
asked on
Find string in file
Hello experts,
Please help me to find solution for the following problem:
In file I need to find string "PORT" between Some 2 other strings. For exmple between "START_BLOCK_1:" and "END_BLOCK" and after that
between "START_BLOCK_2:" and "END_BLOCK"
START_BLOCK_1:
aaa
bbb
PORT=
ccc
ddd
END_BLOCK
START_BLOCK_2:
eee
fff
PORT=
hhh
jjj
END_BLOCK
Thanks
Please help me to find solution for the following problem:
In file I need to find string "PORT" between Some 2 other strings. For exmple between "START_BLOCK_1:" and "END_BLOCK" and after that
between "START_BLOCK_2:" and "END_BLOCK"
START_BLOCK_1:
aaa
bbb
PORT=
ccc
ddd
END_BLOCK
START_BLOCK_2:
eee
fff
PORT=
hhh
jjj
END_BLOCK
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
perl -ne 'print if (/START_BLOCK/../END_BLOCK /) && /PORT/'