I have tried this:
sed -i 's/'Twas/It certainly was/g' *.txt
any suggestions??
I have tried this:
sed -i 's/'Twas/It certainly was/g' *.txt
any suggestions??
The apostrophe in 'Twas is being interpreted as a close quote (by the shell, not sed), and then the subsequent single quote after /g is being interpreted as an open quote, which cheerfully gobbles all the way to the end of the script (or the command prompt, and then you get the mysterious > that means the shell thinks there's more to come). For this situation,
sed -i "s/'Twas/It certainly was/g" *.txt
should work; however, shell double-quoted strings do a lot of stuff you don't usually want with sed programs. If there were any regexp metacharacters at all in there I'd do instead
sed -i 's/'\''Twas/It certainly was/g' *.txt
sed because it doesn't support word-boundary matches. But perl -pi~ -e 's/\bthe\b/a/g; s/\bThe\b/A/g' will do it. I don't know any clever way to do both replacements with one regexp, but maybe someone else does.