I want to find all the files in a dir which has the below multi-line pattern
// *
// *
perl -0777 -i -pe 's/\/\/ \*\s*\n\/\/ \*\s*\n/\/\/ *\n/g' *
// *
// *
and replace with
// *
Typically we might end up in situation like this.. So instead of writing a script for this, we can make life easier with perl one liner...
perl -0777 -i -pe 's/\/\/ \*\s*\n\/\/ \*\s*\n/\/\/ *\n/g' *
-pie
is your standard "replace in place" command-line sequence, and -0777 causes perl to slurp files whole.
No comments:
Post a Comment