I know that i can chnage the RS =something in awk.
Is there any way i can change the \n RS to something for muliline pattern in sed
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short answer: no, you can’t. Sed reads lines of text, not records with fields.
Depending on the nature of your text, you could use
trto first change all\ns to an unused character and your desired (single-character) record separator to\n. Make the changes you want insed, then usetrto change the separators back.You could also manipulate the hold space to let you work with multiple lines of text. This is described in, for example, sed & awk by Dougherty and Robbins.
It’s probably easier just to use
awk, though.