There is a Text file called urls.txt
https://site.tld/a.js
https://site.tld/b.js
https://site.tld/c.js
now I want to grep something from https://site.tld/a.js
I tried this but no success
cat urls.txt | xargs -I% bash -c 'curl -sk "%" | grep -w "*.amazonaws.com"'
Thanks in Advance
CodePudding user response:
The problem is in your grep
regex, having *
in its own (unless you want to actually match on *
). Just remove it:
cat urls.txt | xargs -I% bash -c 'curl -sk "%" | grep "\.amazonaws\.com"'
or create a pattern narrowing down what you want to match on, example:
cat urls.txt | xargs -I% bash -c 'curl -sk "%" | grep -E "[a-z0-9_] \.amazonaws\.com"'
Note that I escaped .
or else it'd match on any character instead of just .
.