Need to skip the first line when reading back a text file
First a disclaimer...I'm using SecureCRT 3.4....yes I know it's 2008, but I've just always used it so please forgive me.
I'm cobbling together a VBS script to automate some route work, and part of it is starting a local text file, cat'ing a file on a unix server, stopping the file, logging into a device and spitting it back out from the local copy. Here's the relevant bit:
crt.Screen.Send "cat /home/djudd/tmp/" & router_name & "_4.txt" & vbCr
Then I'm just using the text book example for reading back a locally created text file:
Const ForReading = 1
Const ForWriting = 2
Dim fso, file, str
Set fso = CreateObject("Scripting.FileSystemObject")
' Note: A runtime exception will be generated if 'input.txt' doesn't exist.
Set file = fso.OpenTextFile("c:\mysession.log", ForReading, False)
crt.Screen.Synchronous = True
Do While file.AtEndOfStream <> True
str = file.Readline
' Send the line with an appended CR
crt.Screen.Send str & Chr(13)
' Wait for my prompt before sending the next line
crt.Screen.Synchronous = False
So here's my question. The local text file created contains a grep command that I don't want spit back into the router config...any ideas on how to get it out? First I tried moving the session.log true statement until after the cat command, then I tried usin WSH to invoke a local copy of "egrep -v" but I suspect my ancient copy of SecureCRT caused that to error out....so right now I'm at a wall. I just need to skip the first line...but the file will vary in length so I dont know what line it will stop on.
Any ideas would help, thanks.
|Display Modes||Rate This Thread|