regex - Regular expression not showing multiple line content -
i have file following format.
<hello> <random1> <random2> .... .... .... <random100> <bye>
i want find whether bye , hello there, , bye below hello. tried regular expression.
grep "hello.*bye" filename
but fails match expected.
you use pcregrep
:
pcregrep -m 'hello(\n|.)*bye' filename
the -m
option makes possible search patterns span line boundaries.
for input, it'd produce:
<hello> <random1> <random2> .... .... .... <random100> <bye>
Comments
Post a Comment