Skip to content

Commit

Permalink
Merge e8ad91e into b338b97
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHepworth authored Jun 29, 2023
2 parents b338b97 + e8ad91e commit 28bded0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
source .venv/bin/activate
chmod +x ./scripts/pseudo_symlink_cls.sh
./scripts/pseudo_symlink_cls.sh
chmod +x ./scripts/find_replace_txt.sh
./scripts/find_replace_txt.sh
shell: bash
#----------------------#
# commit any changes #
Expand Down
35 changes: 35 additions & 0 deletions scripts/find_replace_txt.sh
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

0 comments on commit 28bded0

Please sign in to comment.