|We don't bite newbies here... much|
s/// + tr/// when perl -ni -e on semi-colons in one liners echoed to filesby Don Coyote (Monk)
|on Nov 18, 2012 at 12:05 UTC||Need Help??|
Don Coyote has asked for the
wisdom of the Perl Monks concerning the following question:
After rolling a FORMAT oneliner! :) I echo'd this into a file. Now my laziness is starting to niggle and I decide it is about time to edit in place those semicolons into newlines rather than doing this manually.
After clobbering the file a number of times. I could not get a 'simple' s/// or tr/// to operate on a perl -ni -e command. I eventually split the looping stdin file at the semi-colons and joined with newlines, and this was fine. But I wonder why I wasn't able to s/// or y/// on a looping file? some examples:
file to which one-liner echo'd
attempted commands which either clobbered file and/or produced bareword deaths on tr///
I tried variations further to those shown, and settled for the following solution;
Please can you suggest what I may be assuming incorrectly, in relation to this problem?