How to transform with perl this multiline:
Colours:
Red
Green
Yellow
Blue
In:
Colours: Red
Green
Yellow
Blue
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.
The Unicode linebreak grapheme is
\R, and is supported from v5.10 onwards.You could therefore change the first linebreak to a space in the whole file this way:
There are other ways that aren’t so wasteful of memory, but they can be tricky to get right. You might omit the
-0777and see whether that is good enough for you in this case.EDIT: Regex Escapes
Here are the escapes supported in regexes, including what release it was first supported in, with release numbers rounded toward even beginning with v5.6.