I have a grep command that is trying to filter all the .js files in a log. Here is the command below.
grep -o '[^/]*.j's access_log.txt | sort -u
The output is this
include/js
jquery.js
jquery.jshowoff2.js
jquery.jshowoff.min.js
How do I get rid of the include/js line?
CodePudding user response:
Grep uses regular expression to search for search patterns. This means that .
is a special character that needs to be escaped if it is being used literally. Otherwise it will match any character like it is doing with the include/js
line.
You can escape the dot by preceding it with a \
grep -o '[^/]*\.j's access_log.txt | sort -u