Is there a way to tell ack/grep to ignore minified Javascript? Those files have thousands of characters per line and screw up the search output.
ack 1.x does not have a way to ignore minified javascript directly. This will be addressed in ack 2.0. We're working on it at http://github.com/petdance/ack2 .
Try something like this:
grep foo $(find -name '*.js' -exec file {} \; | grep -v "long lines" | sed 's/:.*//')
find -name '*.js'
finds all the .js files in the current directory and subdirectories.
Adding -exec file {} \;
to the find
command runs the file
command on each result.
The results of file
are piped into grep
, and files listed as having "long lines" are removed from the results.
The descriptions from file
are stripped off with sed
, leaving only the filenames. These are the files grep
will search for "foo."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With