Carlos E. R. wrote:
On 2016-12-03 14:59, Carlos E. R. wrote:
On 2016-12-03 09:07, Per Jessen wrote:
Carlos E. R. wrote:
I just have to finish the cronjob script.
I have a coding problem.
I obtain the current IP this way from the router:
/usr/local/bin/GetIpFromRouter.exp > /run/DDNS/router_output.log CURRENTIP=`grep PPPoE /run/DDNS/router_output.log | awk '{ print $10}'` The first line is an expect script that does a telnet to the router, issues the command "wan show", which produces a text that includes the IP. The second line extracts the IP from the line, like this one:
N/A 1 6 ppp0.1 PPPoE Disable Enable Disable Connected 192.168.1.1\r
The problem is that as the router ends the line in non unix format, the variable awk gets is "192.168.1.1^M".
How can I remove that "^M"?
Maybe use sed instead ? sed -e 's/^.*\([0-9.]\+\).*$/\1/' -- Per Jessen, Zürich (2.4°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org