-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
original_txt=( | ||
'=== "Spark"' | ||
'=== "DuckDB"' | ||
'=== "Athena"' | ||
'=== "PostgreSql"' | ||
'=== "SQLite"' | ||
) | ||
replacement_txt=( | ||
'=== ":simple-apachespark: Spark"' | ||
'=== ":simple-duckdb: DuckDB"' | ||
'=== ":simple-amazonaws: Athena"' | ||
'=== ":simple-postgresql: PostgreSql"' | ||
'=== ":simple-sqlite: SQLite"' | ||
) | ||
|
||
# # Check if the lengths of the arrays are equal | ||
if [ ${#original_txt[@]} -eq ${#replacement_txt[@]} ]; then | ||
# Initialize the command variable | ||
command=() | ||
|
||
# Loop through the arrays simultaneously and create the command | ||
for ((i=1; i<=${#original_txt[@]}; i++)); do | ||
c="-e " # only way I could get it to register `-e` without failure | ||
c+="s/${original_txt[i]}/${replacement_txt[i]}/g" | ||
command+=$c | ||
done | ||
|
||
# appends a series of `-e {find/replace}` calls | ||
find . -type f \( -name "*.py" -o -name "*.md" \) -exec sed -i '' $command {} + | ||
|
||
else | ||
echo "Error: Array lengths do not match" | ||
fi |