Difference between revisions of "Bash oneliners"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
``` | ``` | ||
find /home/www \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g' | find /home/www \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g' | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
+ | for ip in $(cat ips.txt | awk '{print $ | ||
+ | 2}'); do if ping -c 1 -w 2 "$ip" &>/dev/null ; then echo "$ip up"; fi; done | ||
``` | ``` |
Revision as of 16:23, 30 August 2023
grep -rl oldtext . | xargs sed -i 's/oldtext/newtext/g'
find /home/www \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'
for ip in $(cat ips.txt | awk '{print $ 2}'); do if ping -c 1 -w 2 "$ip" &>/dev/null ; then echo "$ip up"; fi; done