CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Net::Telnet. Open, Edit, Save REMOTE file. Is it Possible?

 



n_kabourakis
New User

May 17, 2002, 4:30 AM

Post #1 of 3 (1115 views)
Net::Telnet. Open, Edit, Save REMOTE file. Is it Possible? Can't Post

Hi all,

I have a Perl script which runs on a Unix machine via crontab. The script visits numerous NT 4 PC's via Net::Telnet, searches for specific files in a specific directory, and if the named files are found, it moves them to another directory on the remote NT machine by issuing the mv command.

The problem is that I am trying to find a way to open the remote file in order to make modifications to it and then to save it of course.

Is there any way that I can accomplish this via Net::Telnet? The reason for asking is that I am trying to avoid the use of Net::FTP in order to transfer the file locally, make the changes and upload it again. Worst of all, NT doesn’t use sed and awk... Frown



Cheers,

Nicholas




fashimpaur
User / Moderator

May 17, 2002, 8:37 AM

Post #2 of 3 (1110 views)
Re: [n_kabourakis] Net::Telnet. Open, Edit, Save REMOTE file. Is it Possible? [In reply to] Can't Post

Nicholas,

I have not done this, but after reviewing the information on the module, it seems
that you could use the cmd method to execute any command that you can
execute from a normal telnet command line and get the output returned to your
script. This said, I think you could use 'cat' to get the contents of the file and
store it in a variable to be edited. The problem with this is that putting the
contents of your edits back into that file would not be very easy. Another
possible solution is to use awk or sed commands through this cmd method. Or is
it possible that you could create a shell script to perform on the files on the fly
to make the edits on the machines that the files are located.

Sorry if this was not much help. Again, I just thought maybe some ideas might
generate a spark of an idea to fix your dilemma.

Good Luck,
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";


n_kabourakis
New User

May 20, 2002, 12:35 AM

Post #3 of 3 (1105 views)
Re: [fashimpaur] Net::Telnet. Open, Edit, Save REMOTE file. Is it Possible? [In reply to] Can't Post

Hello again,

Well as you said, you probably have generated an idea! Sly

I can always try to store the contents of the said variable to a file by using echo 'blah blah' > filename mechanism.

The data contained in the files, rarely exceed 9 KB...

I will try this, see how it goes and post feedback for future reference!



Thanks for your help!

Nicholas


(This post was edited by n_kabourakis on May 20, 2002, 12:36 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives