+ 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 😅😅

10th Dec 2020, 8:05 PM
AÉ­oƋɘ É­ovɘʀ
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.
14th Dec 2020, 7:08 PM
Lam Wei Li
Lam Wei Li - avatar