2024-11-02 14:50:07 +07:00
|
|
|
#!/bin/bash
|
2024-11-02 15:15:06 +07:00
|
|
|
set -x
|
2024-11-02 14:50:07 +07:00
|
|
|
# Input file containing URLs and filenames
|
2024-11-02 15:15:06 +07:00
|
|
|
input_file="data.txt"
|
2024-11-02 14:50:07 +07:00
|
|
|
# Output file to save the modified content
|
2024-11-02 15:15:06 +07:00
|
|
|
output_file="data-out.txt"
|
2024-11-02 14:50:07 +07:00
|
|
|
|
|
|
|
# Read through each line of the input file
|
|
|
|
while IFS= read -r line; do
|
|
|
|
# Replace any filename or URL ending with .tar.gz with docker-compose.yml
|
2024-11-02 15:15:06 +07:00
|
|
|
modified_line=$(echo "$line" | sed 's/[a-zA-Z0-9.-]*\.tar\.gz/data.yml/g')
|
2024-11-02 14:50:07 +07:00
|
|
|
# Write the modified line to the output file
|
|
|
|
echo "$modified_line" >> "$output_file"
|
|
|
|
done < "$input_file"
|
|
|
|
|
|
|
|
echo "Replacement complete. Check the file $output_file for results."
|