I have a long string, something like this:
AAA+XXXX+1234++here?'s some text+eol1'BBB+XXXX+1234++here?'s some text+eol2'CCC+XXXX+1234++here?'s some text+eol3'etc.
I would like to parse the string by inserting a new line (\n) after each apostrophe (the line terminator). Unfortunately some apostrophes are escaped by a question mark, meaning they are part of a text field. I tried this:
perl -ne "s/[^?]'/\'\n/g" && print" input.txt
...which doesn't work. It loses the last character from each line because the substitution matches two characters, not one. Can someone suggest a simple one-liner that doesn't drop the last character in each line?
Thanks.
In reply to Simple Substitution by winter67uk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |