GoneHiking
Technical User
I'm writing a script to ping a series of IP addresses and I've got all the logic in place except one piece. At the very end. I'm telling it to ping the IP, but how can I also tell it to send a carriage return (^M) at the end? I tried just a ^M at the end but go an error.
Is there some way to enclose the whole statement, but somehow tell it to interpret ^M as a carriage return, and not a literal ^ and M?
Thanks,
Andy
***********************************************
Sample of raw data
Ethernet0 12.108.00.5 YES NVRAM up up
Loopback0 12.108.200.5 YES NVRAM up up
Serial0 12.108.100.5 YES NVRAM up up
*************************************************
***************************************
This is what "myoutput.txt" looks like:
12.108.00.5
12.108.200.5
12.108.100.5
****************************************
/* Rexx */
ZocCLS
file = "c:\data.txt" -- raw data from router
outfile = "c:\myoutput.txt" --store IP address from raw data
CALL ZocFileDelete outfile --reset file for re-use
do while( lines(file) )
data=LINEIN(file)
PARSE Var data v1 v2 v3 --need second field of raw
--data, so need three variables
call lineout outfile, v2 --send field2 (the IP) of
--raw data to "outfile"
end
peers = "c:\myoutput.txt"
do while( lines(peers) ) --read in IP's from "outfile"
data=LINEIN(peers) --continue reading until no more lines
PARSE Var data v1 --grab field1 (there's only one field)
SAY "ping " v1 --ping each IP
end
Is there some way to enclose the whole statement, but somehow tell it to interpret ^M as a carriage return, and not a literal ^ and M?
Thanks,
Andy
***********************************************
Sample of raw data
Ethernet0 12.108.00.5 YES NVRAM up up
Loopback0 12.108.200.5 YES NVRAM up up
Serial0 12.108.100.5 YES NVRAM up up
*************************************************
***************************************
This is what "myoutput.txt" looks like:
12.108.00.5
12.108.200.5
12.108.100.5
****************************************
/* Rexx */
ZocCLS
file = "c:\data.txt" -- raw data from router
outfile = "c:\myoutput.txt" --store IP address from raw data
CALL ZocFileDelete outfile --reset file for re-use
do while( lines(file) )
data=LINEIN(file)
PARSE Var data v1 v2 v3 --need second field of raw
--data, so need three variables
call lineout outfile, v2 --send field2 (the IP) of
--raw data to "outfile"
end
peers = "c:\myoutput.txt"
do while( lines(peers) ) --read in IP's from "outfile"
data=LINEIN(peers) --continue reading until no more lines
PARSE Var data v1 --grab field1 (there's only one field)
SAY "ping " v1 --ping each IP
end