in reply to Simple Substitution

I think you might be having a shell quoting problem. The backslashes are swallowed by the shell if this is under sh. Try this:

perl -wne 's/[^?]\47/\47\n/g; print' filename

This solution won't work if you have two consecutive (unescaped) apostrophes, or if the file has no newlines and is too long to read in memory.

Replies are listed 'Best First'.
Re^2: Simple Substitution
by winter67uk (Initiate) on Jan 14, 2005 at 10:56 UTC
    Thanks ambrus, well done for spotting the unnecessary double quote after the substitution - s/.../.../g". The Windows command environment requires double quotes, but I mistakenly included an extra one in the code I posted.