toneharb
11-20-2005, 03:48 PM
I find this command on LINUX useful for global searches and replacings
perl -pi -e 's/search/replace/g' filename(s)
I am having a spot of trouble though with replacing a string which contains the literal single apostrophe ' character
ie: 'string'
I have tried perl -pi -e 's/\'string\'/replace/g' filenames
and have also atempted perl -pi -e 's/\o47string\o47/replace/g' filenames
The command interpreter seems to think its a multi-line command for (1) and for (2) it doesn't find a match so octal 47 escape sequence does seem to mean '
Any Perl command line gurus know the solution to this Unix problem ?
perl -pi -e 's/search/replace/g' filename(s)
I am having a spot of trouble though with replacing a string which contains the literal single apostrophe ' character
ie: 'string'
I have tried perl -pi -e 's/\'string\'/replace/g' filenames
and have also atempted perl -pi -e 's/\o47string\o47/replace/g' filenames
The command interpreter seems to think its a multi-line command for (1) and for (2) it doesn't find a match so octal 47 escape sequence does seem to mean '
Any Perl command line gurus know the solution to this Unix problem ?