Home > Archive > PERL Beginners > October 2005 > about running unix command in perl script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
about running unix command in perl script
|
|
| Bing Zhao 2005-10-28, 7:56 am |
| Hi,
Is there a way to run unix command in perl?
To be specific, for the ftp command:
1.ftp ftp.rcsb.org
2.cd /pub/pdb/data/structures/divided/pdb/
3.cd nx
4.get pdb1nxc.ent.Z
5.bye
I need to automate this process to ftp get the file pdb1nxc.ent.Z.
thank you.
bing
| |
| John W. Krahn 2005-10-28, 7:56 am |
| ZHAO, BING wrote:
> Hi,
Hello,
> Is there a way to run unix command in perl?
> To be specific, for the ftp command:
> 1.ftp ftp.rcsb.org
> 2.cd /pub/pdb/data/structures/divided/pdb/
> 3.cd nx
> 4.get pdb1nxc.ent.Z
> 5.bye
> I need to automate this process to ftp get the file pdb1nxc.ent.Z.
perldoc Net::FTP
John
--
use Perl;
program
fulfillment
| |
| Dermot Paikkos 2005-10-28, 7:56 am |
| Have a look at Net::FTP. It can do all that your asking.
I think it's part of the standard distribution.
perldoc Net::FTP
hth.
Dp.
On 28 Oct 2005 at 3:37, ZHAO, BING wrote:
> Hi,
> Is there a way to run unix command in perl?
> To be specific, for the ftp command:
> 1.ftp ftp.rcsb.org
> 2.cd /pub/pdb/data/structures/divided/pdb/
> 3.cd nx
> 4.get pdb1nxc.ent.Z
> 5.bye
> I need to automate this process to ftp get the file pdb1nxc.ent.Z.
> thank you.
>
> bing
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
| |
| John Doe 2005-10-28, 7:56 am |
| ZHAO, BING am Freitag, 28. Oktober 2005 12.37:
> Hi,
> Is there a way to run unix command in perl?
> To be specific, for the ftp command:
> 1.ftp ftp.rcsb.org
> 2.cd /pub/pdb/data/structures/divided/pdb/
> 3.cd nx
> 4.get pdb1nxc.ent.Z
> 5.bye
> I need to automate this process to ftp get the file
> pdb1nxc.ent.Z. thank you.
yes,
perldoc system
perldoc perlop (backticks)
several IPC modules
....but you'll save a headache using the Net::FTP module, see
http://search.cpan.org/search?query...FTP&mode=module
hth,
joe
| |
| José Pedro Silva Pinto 2005-10-28, 7:56 am |
| Yes
Example:
system("ftp ftp.rcsb.org ; /pub/pdb/data/structures/divided/pdb/ ; cd nx =
; get pdb1nxc.ent.Z ");
By
Jos=E9 Pinto
-----Original Message-----
From: ZHAO, BING [mailto:littleshrimp@berkeley.edu]=20
Sent: sexta-feira, 28 de Outubro de 2005 11:37
Cc: beginners@perl.org
Subject: about running unix command in perl script
Hi,
Is there a way to run unix command in perl?
To be specific, for the ftp command:
1.ftp ftp.rcsb.org
2.cd /pub/pdb/data/structures/divided/pdb/
3.cd nx
4.get pdb1nxc.ent.Z
5.bye
I need to automate this process to ftp get the file =
pdb1nxc.ent.Z.
thank you.
bing
--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
| |
| Dan Klose 2005-10-28, 7:56 am |
|
On Fri, 2005-10-28 at 03:37 -0700, ZHAO, BING wrote:
> Hi,
> Is there a way to run unix command in perl?
> To be specific, for the ftp command:
> 1.ftp ftp.rcsb.org
> 2.cd /pub/pdb/data/structures/divided/pdb/
> 3.cd nx
> 4.get pdb1nxc.ent.Z
> 5.bye
> I need to automate this process to ftp get the file pdb1nxc.ent.Z.
> thank you.
>
> bing
Hello,
To get PDBs from the PDB!
try this:
#!/usr/bin/perl
#THIS SCRIPT WAS WRITTEN BY JAIME PRILUSKY @ WEIZMANN INSTITUTE
use LWP::Simple;
my @ids = @ARGV;
die "\nUsage: $0 PDBid PDBid\n\n" if ($ARGV[0] =~ /^ *$/);
foreach $id (@ids) {
my $pdbfile = $id . "\.pdb";
my $status = mirror("http://bip.weizmann.ac.il/oca-bin/save-pdb?$id",
$pdbfile);
if (-z $pdbfile) {
print "Unable to retrieve $pdbfile\n";
unlink($pdbfile);
} else {
print "Retrieved $pdbfile\n";
}
}
Thanks to Jaime Prilusky. I find this script rather handy.
>
--
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA
|
|
|
|
|