curl www.google.com | grep "href=" And this will find all the links embedded in the Google homepage.
using grep after curl allows you to search for specific things like hyperlinks and other parts of a page.
curl www.google.com | grep "href=" And this will find all the links embedded in the Google homepage.
using grep after curl allows you to search for specific things like hyperlinks and other parts of a page.
You can also use grep to filter the output of other Unix utilities via command-line piping: who | grep vickie
you can add grep after another utility to filter its output.
all grep options
several search tips with grep in shell.
# line containing 'cake' but not 'at' # same as: grep 'cake' table.txt | grep -v 'at' # with PCRE: grep -P '^(?!.*at).*cake' table.txt $ awk '/cake/ && !/at/' table.txt blue cake mug shirt -7
It should be easier to use awk over bash, especiallly for AND conditions.
For example, for "line containing cake but not at":
* grep: grep 'cake' table.txt | grep -v 'at'
* grep with PCRE: grep -P '^(?!.*at).*cake' table.txt
* awk: awk '/cake/ && !/at/' table.txt