/ Published in: Perl
A combination of the instructions in the book Minimal Perl and this Perl one-liners page
The general form of the one-liner is:
> perl -wnl -e '/REGEX/ and print $ARGV." $.: $_"; close ARGV if eof' <files>
The example below shows how to print the hex colors that are defined in a Sass source tree.
Expand |
Embed | Plain Text
# search files in a directory perl -wnl -e '/\s#[0-9a-zA-Z]{3,6}\b/ and print $ARGV." $.: $_"; close ARGV if eof' *sass # search a filesystem find . -name "*sass" | xargs perl -wnl -e '/\s#[0-9a-zA-Z]{3,6}\b/ and print $ARGV." $.: $_"; close ARGV if eof'
You need to login to post a comment.
