Friday, 29 November 2019

curl a url and parse if a key word occurrences

you can curl url | grep "your keyword"  to check if it has your keyword.

curl | grep "google"
you can test above command it will give result.

curl | grep "googlexxxx"

above will have no result , because it doesn't have your keyword.

curl | grep "google" -o

above with -o which will only show matches and occurrence.

you will see a lot of "google"in result.

to count them you can use  | wc -l

so the final command is:

curl | grep "google" -o | wc -l

No comments:

Post a comment