Skip to content

Instantly share code, notes, and snippets.

@vishnukumarpv
Last active January 24, 2023 10:04
Show Gist options
  • Save vishnukumarpv/3e8ac7a3483611cd26eb508e48ec24a5 to your computer and use it in GitHub Desktop.
Save vishnukumarpv/3e8ac7a3483611cd26eb508e48ec24a5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Declare an array to store the URLs
urls=()
# Read the URLs from the text file
while IFS= read -r line; do
urls+=($line)
done < "list.txt"
# Loop through the array of URLs
for url in "${urls[@]}"
do
# Make a GET request to each URL and store the response code
response_code=$(curl -s -o /dev/null -w "%{http_code}" $url)
# Check if the response code is not 200 (OK)
if [ $response_code -ne 200 ]
then
echo "Error: $url returned a $response_code response code"
else
echo "$url is up and running"
fi
done
#!/bin/bash
# Create a list of all .yml files in the current directory
files=$(ls -1 *.yml)
# Iterate through the list of files
for file in $files; do
# Use grep to extract the line containing "uuid"
# Use awk to extract the value of "uuid"
uuid=$(grep "uuid" $file | awk '{print $2}')
echo "$file: $uuid"
done
@vishnukumarpv
Copy link
Author

#!/bin/bash

Create a list of all .yml files in the current directory

files=$(ls -1 *.yml)

Iterate through the list of files

for file in $files; do
# Use grep to extract the line containing "uuid"
# Use awk to extract the value of "uuid"
uuid=$(grep "uuid" $file | awk '{print $2}')
echo "$file: $uuid"
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment