+ 1
shell script
hello everyone i need a little help with a script to extract a specific url within a source code for diffrent pages in a website the url looks like this: <a href="https://drive.google.com/file/...."> my script (bash shell): for i in {1.100} do curl https://example.com/$i_page | grep "https://drive....." > file$i.txt done the problem here is how i can use grep to extract the url đ đ
1 Answer
+ 2
Separate into 2 grep queries:
grep -Eo "https?.+?[\"\']" | grep -o "[^\"\' ]+"
First, grep http or https ending with the nearest single or double quote.
Second, grep everything except the single or double quote.