LAN remote file read, parse, write and move by shell

Alex Rice alex at
Sat Oct 19 22:08:01 EDT 2002

On Wednesday, October 2, 2002, at 08:08  PM, Sannyasin Sivakatirswami 

> I don't know much shell scripting and am currently using FTP for this 
> locally, it works, but its slow.
> But is has been pointed out to me that  possibly native UNIX commands 
> could be run to do the same thing... this is an a MAC OSX network. 
> (where the remote machines are running OSX and the work stations also 
> running OSX
> Can anyone put this together in a combo of shell commands and 
> transcript? Note the intention is NOT to have to mount the remote 
> volumes on the desktop of the processing machine, but to 'talk' to 
> them directly. using UNIX stuff like "rcp"

I would recommend scp (secure copy). It's part of SSH (secure shell) 
and comes with OS X. After you have enabled remote logins in the system 
preferences of the remote machine, you have enabled SSH. See the scp 
manual mage, "man scp" at the shell.
> 1) read file (a) from remote machine (OSX server) on the LAN into 
> variable on this machine

This shell script hasn't been tested, but might give you some ideas. 
Note that scp usually interactively asks for a password. However, in a 
shell situation you don't have the option of typing in the password so, 
I think, you have to use the -i <identity-file> option of scp to use an 
RSA keypair instead of passwords.

put shell("scp <username>@<remotehost> -i<identity-file> <remotefile> 
<localfile>") \
  into tRes

-- check tRes for errors here
put URL "file:<localfile>" into tContent

> 2) parse that file for a chunk ## each to use TRanscript for this

split(tContent <delim1> <delim2>...)
-- find the chunk and put it in tResult

> 3) Write that chunk back out to file (b) to a different volume on the 
> same or another remote machine on the LAN

put tResult into URL "file:<outfile>"

> 4) move file (a) from one directory to another on the same machine 
> where it resides.

I hope this helps get you started. Just dive in at the and 
start reading man pages!

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at
alex_rice at

More information about the use-livecode mailing list