Is it possible to loop thru rows of a file?
[admin@MikroBot] file> :put [/file get countries.txt name]
countries.txt
[admin@MikroBot] file> :put [/file get countries.txt contents]
The second command does nothing … I would assume ‘contents’ means whats in the file but nothing comes out. I’m trying to take a file with a list of IP ranges and run a command using :foreach on them, but the get contents doesn’t seem to work.
Sam
Well, it does seem to give the contents:
[admin@EricsHome] file> :put [/file get someips.txt contents ]
1.2.3.4
100.200.200.100
4.3.2.1
But, it does appear to be crlf terminated in the DOS style, and when I try looping through it with :foreach, I get this:
[admin@EricsHome] file> :foreach x in [/file get someips.txt contents ] do={:put ($x . $x)}
1.2.3.4
100.200.200.100
4.3.2.1
1.2.3.4
100.200.200.100
4.3.2.1
So, you would probably have to do some “:find”-ing, and some “:pick”-ing to make it useful.
Hey MT dudes, how about some sort of :grep, :sed, and :awk. 
–Eric
Hmm… seems that it doesn’t like big files. I’ve used the same file format for both and I can get them to work if they aren’t as long. I will see if I can find a reason for it. Maybe the buffer can only read a certain amount of lines and then it dies? I will see what I can find.
Sam