Created
December 4, 2023 01:51
-
-
Save pen-pal/2baf1780f338b0292395e2b24313210e to your computer and use it in GitHub Desktop.
create file based on parameter store name `/dev/hello/env` as `dev-hello-env` in local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/dev/hello/a | |
/dev/hello/b | |
/dev/hello/c | |
/dev/hello/d | |
/dev/hello/e | |
/dev/hello/f | |
/dev/hello/g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Input file path | |
input_file="path/to/your/input/file.txt" | |
# Directory where the new files will be created | |
output_dir="path/to/your/output/directory" | |
# Create output directory if it doesn't exist | |
mkdir -p "$output_dir" | |
# Read the input file line by line | |
while IFS= read -r line; do | |
# Replace '/' with '-' except the first '/' | |
new_file_name=$(echo "$line" | awk '{gsub(/\//,"-"); print}') | |
new_file_name="${new_file_name#-}" | |
# Create the new file with the modified name | |
touch "$output_dir/$new_file_name" | |
done < "$input_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment