Been trying to get this working for a while and not really quite getting it.
Basically, I have a file with an ip address that changes more or less on a daily basis. The file only contains one ip address and this is the one I'm trying to replace with my crazy grepping to find my current internal ip.
I have this
#!/bin/sh
newip=$(ifconfig | grep 0xfff | grep -Eo '([0-9]{1,3}.){3}[0-9]{1,3}' | grep -v 255)
echo $newip
sed 's/*.*.*.*/"$newip"/g' log.txt > logmod.txt
but it's not matching and replacing.
I'm not familiar with sed and I am a beginner with regexps too.
Any help would be awesome!
Thanks :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…