Read a file line by line assigning the value to a variable
Checking for the correct number of arguments
Find all directories within a path that contain files matching pattern:
find . -type f -iname *adf -printf "%h\n" | sort | uniq >/tmp/adf_dirs.txt
Above is using simple wildcard matching, it is also possible to use regex:
find . -regextype sed -iregex ".*/.*\.adf$" -printf "%h\n"|sort|uniq >/tmp/adf_dirs.txt
https://stackoverflow.com/questions/6844785/how-to-use-regex-with-find-command
I use this script to search and replace the domain name in the WordPress database to adjust a fresh copy from the production site.
Replaces every occurence of ‘www.domainname.tld’ and ‘domainname.tld’ with ‘dev.domainname.tld’.
You then access the development site by adding it to your ‘hosts’ file or internal DNS.
#!/bin/sh
echo File: $1 Replace: $2
cp $1 $1.bak
perl -p -i -e "s|www\.$2|dev\.$2|g" $1
perl -p -i -e "s|://$2|://dev\.$2|g" $1