launch a DOS program from a Perl script?
launch a DOS program from a Perl script?
am 11.11.2007 00:30:04 von lucavilla
Can I launch a DOS program from within a Perl script?
____
This is what I need to do:
I have many files like this:
c:\dir\pippo-red.html
c:\dir\paperino-yellow.html
c:\dir\pluto-red.html
c:\dir\gastone-green.html
I have a HTML2TXT.EXE program that converts files from html to txt
(removing the tags etc...).
The syntax of this program is: "HTML2TXT htmlfilename.htm >
txtfilename.txt"
I want to convert all and only the file which path-name match "c:\dir
\*-red.html". The output files must have the suffix "-text" in the
filename and ".txt" as extension.
In a few words the Perl script in this example must execute the
command two times like this:
HTML2TXT c:\dir\pippo-red.html > c:\dir\pippo-red-text.txt
HTML2TXT c:\dir\pluto-red.html > c:\dir\pluto-red-text.txt
Do you know how can I do this?
Thanks in advance for any help
Re: launch a DOS program from a Perl script?
am 11.11.2007 01:43:53 von jurgenex
Luca Villa wrote:
> Can I launch a DOS program from within a Perl script?
perldoc -f system
perldoc -f qx
jue
Re: launch a DOS program from a Perl script?
am 11.11.2007 02:04:31 von Ron Bergin
On Nov 10, 3:30 pm, Luca Villa wrote:
> Can I launch a DOS program from within a Perl script?
>
> ____
>
> This is what I need to do:
>
> I have many files like this:
> c:\dir\pippo-red.html
> c:\dir\paperino-yellow.html
> c:\dir\pluto-red.html
> c:\dir\gastone-green.html
>
> I have a HTML2TXT.EXE program that converts files from html to txt
> (removing the tags etc...).
>
> The syntax of this program is: "HTML2TXT htmlfilename.htm >
> txtfilename.txt"
>
> I want to convert all and only the file which path-name match "c:\dir
> \*-red.html". The output files must have the suffix "-text" in the
> filename and ".txt" as extension.
>
> In a few words the Perl script in this example must execute the
> command two times like this:
> HTML2TXT c:\dir\pippo-red.html > c:\dir\pippo-red-text.txt
> HTML2TXT c:\dir\pluto-red.html > c:\dir\pluto-red-text.txt
>
> Do you know how can I do this?
>
> Thanks in advance for any help
It's proper ediquite to inform people that you've posted this question
in multiple forums and have received the solution.
http://www.experts-exchange.com/Programming/Languages/Script ing/Perl/Q_22952500.html
Re: launch a DOS program from a Perl script?
am 11.11.2007 14:10:45 von lucavilla
This seems to be the solution:
system "HTML2TXT $_ > ".(/(.*)html/)[0]."txt" for ;
but how can I launch it from command-line?
I tried PERL 'system "HTML2TXT $_ > ".(/(.*)html/)[0]."txt" for
dir/*-red.html>;' without success...
sorry for my incompetence..
Re: launch a DOS program from a Perl script?
am 11.11.2007 17:22:34 von jurgenex
Luca Villa wrote:
> This seems to be the solution:
> system "HTML2TXT $_ > ".(/(.*)html/)[0]."txt" for ;
Well, I am not to argue with you but that is not even valid Perl code:
Bareword found where operator expected at t.pl line 5, near "dir"
(Missing operator before dir?)
Bareword found where operator expected at t.pl line 5, near "*-red"
(Missing operator before red?)
syntax error at t.pl line 5, near "dir"
t.pl had compilation errors.
<\quote>
You may want to fix that first.
jue
Re: launch a DOS program from a Perl script?
am 11.11.2007 19:58:43 von Ron Bergin
On Nov 11, 8:22 am, "Jürgen Exner" wrote:
> Luca Villa wrote:
> > This seems to be the solution:
> > system "HTML2TXT $_ > ".(/(.*)html/)[0]."txt" for ;
>
> Well, I am not to argue with you but that is not even valid Perl code:
>
> Bareword found where operator expected at t.pl line 5, near "dir"
> (Missing operator before dir?)
> Bareword found where operator expected at t.pl line 5, near "*-red"
> (Missing operator before red?)
> syntax error at t.pl line 5, near "dir"
> t.pl had compilation errors.
> <\quote>
> You may want to fix that first.
>
> jue
It might help if you type in the command correctly when testing.
dir/*-red.html>
is not the same as
Re: launch a DOS program from a Perl script?
am 11.11.2007 20:26:45 von lucavilla
The solution was:
perl -e "system qq'HTML2TXT $_ > '.(/(.*)html/)[0].'txt' for
red.html>"
Re: launch a DOS program from a Perl script?
am 11.11.2007 20:57:34 von jurgenex
Ron Bergin wrote:
> On Nov 11, 8:22 am, "Jürgen Exner" wrote:
>> t.pl had compilation errors.
>> <\quote>
>> You may want to fix that first.
>>
>> jue
>
> It might help if you type in the command correctly when testing.
>
> dir/*-red.html>
>
> is not the same as
>
>
Indeed. Copy-and-paste error of the oversized line.
My mistake.
jue
Re: launch a DOS program from a Perl script?
am 11.11.2007 21:37:03 von veatchla
Luca Villa wrote:
> Can I launch a DOS program from within a Perl script?
>
> ____
>
> This is what I need to do:
>
> I have many files like this:
> c:\dir\pippo-red.html
> c:\dir\paperino-yellow.html
> c:\dir\pluto-red.html
> c:\dir\gastone-green.html
>
> I have a HTML2TXT.EXE program that converts files from html to txt
> (removing the tags etc...).
>
> The syntax of this program is: "HTML2TXT htmlfilename.htm >
> txtfilename.txt"
>
> I want to convert all and only the file which path-name match "c:\dir
> \*-red.html". The output files must have the suffix "-text" in the
> filename and ".txt" as extension.
>
> In a few words the Perl script in this example must execute the
> command two times like this:
> HTML2TXT c:\dir\pippo-red.html > c:\dir\pippo-red-text.txt
> HTML2TXT c:\dir\pluto-red.html > c:\dir\pluto-red-text.txt
>
>
> Do you know how can I do this?
>
>
> Thanks in advance for any help
>
Do you need to use Perl? Use plain old DOS?
for %F in (c:\dir\*-red.html) do HTML2TXT "%F" > "%~dF%~pF%~nF.txt"
execute for /? for information.
--
Len
Re: launch a DOS program from a Perl script?
am 11.11.2007 23:27:49 von lucavilla
> Do you need to use Perl? Use plain old DOS?
>
> for %F in (c:\dir\*-red.html) do HTML2TXT "%F" > "%~dF%~pF%~nF.txt"
Genial!
I'm very happy that there is still someone on this earth that master
DOS/BATCH commands.
Thank you VERY VERY much Len! I'll use your solution!
"for /?" revealed an hidden treasure
BTW are there any active communities/forums/message boards on the web
to discuss DOS/BATCH commands?
Re: launch a DOS program from a Perl script?
am 12.11.2007 02:11:13 von spambait
In article <1194820069.976992.246250@o38g2000hse.googlegroups.com>, Luca Villa wrote:
>
>> Do you need to use Perl? Use plain old DOS?
>>
>> for %F in (c:\dir\*-red.html) do HTML2TXT "%F" > "%~dF%~pF%~nF.txt"
>
>Genial!
>
>I'm very happy that there is still someone on this earth that master
>DOS/BATCH commands.
>
>Thank you VERY VERY much Len! I'll use your solution!
>
>"for /?" revealed an hidden treasure
>
>BTW are there any active communities/forums/message boards on the web
>to discuss DOS/BATCH commands?
>
alt.msdos.batch
alt.msdos.batch.nt
--
Regards,
Doug Miller (alphageek at milmac dot com)
It's time to throw all their damned tea in the harbor again.