Skip to content

Instantly share code, notes, and snippets.

@shreshthmohan
Last active September 1, 2022 12:16
Show Gist options
  • Save shreshthmohan/21df96252ac17a06c1eb48aa7dd2e4cd to your computer and use it in GitHub Desktop.
Save shreshthmohan/21df96252ac17a06c1eb48aa7dd2e4cd to your computer and use it in GitHub Desktop.
multiline echo with variable in bash (shell)
#!/bin/bash
for i in {1..414}
do
wget https://embedwistia-a.akamaihd.net/deliveries/3c663245548ad526f09fc4b1e2b4bb73927800bf.m3u8/seg-$i-v1-a1.ts
done
# wget files in a for loop
#!/bin/bash
for i in {1..182}
do
echo "curl 'https://ceo.gujarat.gov.in/CEOImages/ACMAP/"$i".jpg' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
-H 'Accept-Language: en-US,en;q=0.9,hi;q=0.8,fr;q=0.7' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Cookie: ASP.NET_SessionId=rhhpso55ikazkywhc5ikiftr; _ga=GA1.3.1316210540.1660757527; Font=; _gid=GA1.3.248189223.1661947501' \
-H 'Pragma: no-cache' \
-H 'Sec-Fetch-Dest: document' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'Sec-Fetch-User: ?1' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: \"Chromium\";v=\"104\", \" Not A;Brand\";v=\"99\", \"Google Chrome\";v=\"104\"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: \"macOS\"' \
--compressed --output "$i".jpg" >> curllist.sh
done
echo 'seg-'{1..161}'-v1-a1.ts' | tr " " "\n" > tslist
while read line; do cat $line >> combined.ts; done < tslist
# create a list of files named seg-1-v1-a1.ts
# add them to a new line on tslist file
# read each line and combine the contents to form combined.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment