Which language? Not possible with standard sed AFAIK.
Can do with standard ed though: echo -e 'g/:$/j\n,p' | ed -s test.txt
If you don't know whether newlines are \n or \r\n: echo -e 'g/:\r*$/j\n,p' | ed -s test.txt
You still would need to get rid of ? below, or use \nw at the end of the command to edit in place.
Please Login to reply.
No replies yet.