Anuj Kaushal

Bash script to get HTTP response code from list of URL

May 12, 2020, by anuj, category Bash, Blog

While preparing list of active stores i had to create following script because the list of stores were in hundreds. Here is a simple bash script to read list of URLs from a text file and generate the output in a separate file with comma delimited.

# Input filename
# ./urls.txt
https://in.yahoo.com/
http://anujkaushal.info/
https://aninews.in/
http://anujkaushal.info/
# Output filename
# ./result.txt
ResponseCode, URL
200, https://in.yahoo.com/
302, http://anujkaushal.info/
200, https://aninews.in/
200, http://anujkaushal.info/