page 235, the second paragraph, option -i [extension], ends with “as below”, followed by :
The code tag should not be here.
In the previous version it was :
$ ruby -pi.bak -e "gsub(/Perl/, 'Ruby')" *.txt}
with an unmatched closing brace.
If I am in code directory, after copying tut_threads/testfile to code, I can run :
ruby -pi.bak -e "gsub(/This/, 'that')" testfile
testfile
has changed :
that is line one
that is line two
that is line three
And so on...
and there is a new testfile.bak
:
This is line one
This is line two
This is line three
And so on...
+++++ Same for option -s, which was :
$ ruby -s prog -opt=electric ./mydata