A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

January 2, 2011

help please: apply REGEX to multiple lines?

Forums: 

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

Click Here!