grep 文本文件中的所有 .js url
grep all .js urls from text file
有一个文件a.txt
https://site.tld/anythingjs.html
https://site.tld/b.txt
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
我想 grep 所有 .js
扩展 URL,所以我尝试了这个,但它没有显示 https://site.tld/b.js?query=1
$ cat a.txt | grep '.js$'
https://site.tld/a.js
http://site.tld/c.js
http://site.tld/d.js
当我尝试这个时,它还 select js
来自任何地方的名字
$ cat a.txt | grep '.js$*'
https://site.tld/anythingjs.html
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
提前致谢
只是逃离 .用 \
$ cat a.txt
https://site.tld/anythingjs.html
https://site.tld/b.txt
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
$ grep '\.js' a.txt
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
有一个文件a.txt
https://site.tld/anythingjs.html
https://site.tld/b.txt
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
我想 grep 所有 .js
扩展 URL,所以我尝试了这个,但它没有显示 https://site.tld/b.js?query=1
$ cat a.txt | grep '.js$'
https://site.tld/a.js
http://site.tld/c.js
http://site.tld/d.js
当我尝试这个时,它还 select js
来自任何地方的名字
$ cat a.txt | grep '.js$*'
https://site.tld/anythingjs.html
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
提前致谢
只是逃离 .用 \
$ cat a.txt
https://site.tld/anythingjs.html
https://site.tld/b.txt
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js
$ grep '\.js' a.txt
https://site.tld/a.js
https://site.tld/b.js?query=1
http://site.tld/c.js
http://site.tld/d.js