Skip to content

Instantly share code, notes, and snippets.

@rootsongjc
Last active July 12, 2020 07:46
Show Gist options
  • Save rootsongjc/39e3a6758d3f6376bc4b21851c725670 to your computer and use it in GitHub Desktop.
Save rootsongjc/39e3a6758d3f6376bc4b21851c725670 to your computer and use it in GitHub Desktop.
#!/bin/bash
# replace URL
seperator="→"
config="filename"
#config style
#https://a.com→https://b.com
destination="destination"
for line in `cat $config`;do
echo $line
before=`echo $line|cut -d $seperator -f1|sed 's#\/#\\\/#g'`
after=`echo $line|cut -d $seperator -f2|sed 's#\/#\\\/#g'`
sed -i "" "s/$before/$after/g" $destination
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment