Recently used Perl one-liner on Linux to replace the strings in SPVM source codes.
This command is dangerous because it does replacement
find * | grep -P '\.(spvm|c|h|xs|y|pm|pod|t)$' | xargs perl -pi -e 's/descriptor/attribute/g'
For Programming Beginners
find *
searches all files except for hidden files in the current directory.
|
is the pipe.
grep -P '\.(spvm|c|h|xs|y|pm|pod|t)$'
extracts files of the specific extensions.
xargs
passes each file from the pipe as an argument of the command and executes the command.
perl -pi -e 's/descriptor/attribute/g'
replaces all descriptor
with attribute
.
Top comments (1)
Could also do the same with
sed -i
.