NextWeb/dev/replace.sh

16 lines
559 B
Bash
Raw Permalink Normal View History

#!/bin/bash
2024-11-02 15:15:06 +07:00
set -x
# Input file containing URLs and filenames
2024-11-02 15:15:06 +07:00
input_file="data.txt"
# Output file to save the modified content
2024-11-02 15:15:06 +07:00
output_file="data-out.txt"
# 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')
# 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."