Welcome to the Linux Foundation Forum!

help please: apply REGEX to multiple lines?

hi friends! happy new year!

i never manage to do a regex includeing multiple lines, does anyone has an idea about that?

imagin you have a file

a

b

c

and you want to turn it into just

b

but without useing grep next line/line before

it needs to be something like:

sed -i "s#a\n(b\n)c\n#$1#g" file (which does not work)

thanks a lot

Comments

  • Posts: 134
    why not cat or grep ?
    grep with regexp are easy ? is there a reason to avoid it ?

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training