Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Search.bat from the command line

Reply
Thread Tools

Search.bat from the command line

 
 
bdy120602@gmail.com
Guest
Posts: n/a
 
      06-17-2008
I'm doing a search from the DOS prompt using the Perl search function
and I would like to search for a special character ($), but the Perl
command doesn't seem to be able to find it. I surround the dollar sign
in quotation marks, and it listed all the files in the directory,
which led me to believe that it couldn't initiate the search properly
because not all the documents contain the $. If I use search from the
Perl command line, meaning after I type "Perl" at the commadn prompt,
I receive

search/"$"
Final $ should be \$ or $name at - line 1, within string
syntax error at - line 1, near "/"$""

Also, I'm searching RTF files. which have HTML coding behind them. Is
there anyway to have Perl search just the text and not the code?

Thanks.
 
Reply With Quote
 
 
 
 
Brian Helterlilne
Guest
Posts: n/a
 
      06-17-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I'm doing a search from the DOS prompt using the Perl search function
> and I would like to search for a special character ($), but the Perl
> command doesn't seem to be able to find it. I surround the dollar sign
> in quotation marks, and it listed all the files in the directory,
> which led me to believe that it couldn't initiate the search properly
> because not all the documents contain the $. If I use search from the
> Perl command line, meaning after I type "Perl" at the commadn prompt,
> I receive
>
> search/"$"
> Final $ should be \$ or $name at - line 1, within string
> syntax error at - line 1, near "/"$""


perl doesn't have a search function. I think you mean you have a perl
program called search.pl that searches files.

Since you haven't shown us the code, it is hard to tell what the problem
is, but an educated guess is that your program is using regular
expressions to locate the search string. the '$' character is special
within a regular expression. Depending on what you want, you can either
escape it within the string \$ or modify the program to not treat any
characters as special within the RE (e.g. \Q$string)

>
> Also, I'm searching RTF files. which have HTML coding behind them. Is
> there anyway to have Perl search just the text and not the code?


you would need to parse the file using one of the many HTML parsing modules.

>
> Thanks.


--
-brian
 
Reply With Quote
 
 
 
 
bdy120602@gmail.com
Guest
Posts: n/a
 
      06-18-2008
On Jun 17, 5:53*pm, Brian Helterlilne <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > I'm doing a search from the DOS prompt using the Perl search function
> > and I would like to search for a special character ($), but the Perl
> > command doesn't seem to be able to find it. I surround the dollar sign
> > in quotation marks, and it listed all the files in the directory,
> > which led me to believe that it couldn't initiate the search properly
> > because not all the documents contain the $. If I use search from the
> > Perl command line, meaning after I type "Perl" at the commadn prompt,
> > I receive

>
> > search/"$"
> > Final $ should be \$ or $name at - line 1, within string
> > syntax error at - line 1, near "/"$""

>
> perl doesn't have a search function. *I think you mean you have a perl
> program called search.pl that searches files.
>
> Since you haven't shown us the code, it is hard to tell what the problem
> is, but an educated guess is that your program is using regular
> expressions to locate the search string. *the '$' character is special
> within a regular expression. *Depending on what you want, you can either
> escape it within the string \$ or modify the program to not treat any
> characters as special within the RE (e.g. \Q$string)
>
>
>
> > Also, I'm searching RTF files. which have HTML coding behind them. Is
> > there anyway to have Perl search just the text and not the code?

>
> you would need to parse the file using one of the many HTML parsing modules.
>
>
>
> > Thanks.

>
> --
> -brian


Oh, OK. Yes, I want to treat the "$" as a string literal, and the
backslash allowed me to do that. Would you provide me with the options
that are available when using search? Yes, I forgot to mention that
that's the name of the program. Search is a batch file found in /Perl/
bin, but I can't find instruction for it with perldoc.

Also, would you provide more informatino on how I would use an HTML
parser to search only the text instead of the HTML? Thanks.
 
Reply With Quote
 
Brian Helterlilne
Guest
Posts: n/a
 
      06-18-2008
(E-Mail Removed) wrote:
> On Jun 17, 5:53 pm, Brian Helterlilne <(E-Mail Removed)> wrote:
>> (E-Mail Removed) wrote:
>>> I'm doing a search from the DOS prompt using the Perl search function
>>> and I would like to search for a special character ($), but the Perl
>>> command doesn't seem to be able to find it. I surround the dollar sign
>>> in quotation marks, and it listed all the files in the directory,
>>> which led me to believe that it couldn't initiate the search properly
>>> because not all the documents contain the $. If I use search from the
>>> Perl command line, meaning after I type "Perl" at the commadn prompt,
>>> I receive
>>> search/"$"
>>> Final $ should be \$ or $name at - line 1, within string
>>> syntax error at - line 1, near "/"$""

>> perl doesn't have a search function. I think you mean you have a perl
>> program called search.pl that searches files.
>>
>> Since you haven't shown us the code, it is hard to tell what the problem
>> is, but an educated guess is that your program is using regular
>> expressions to locate the search string. the '$' character is special
>> within a regular expression. Depending on what you want, you can either
>> escape it within the string \$ or modify the program to not treat any
>> characters as special within the RE (e.g. \Q$string)
>>
>>
>>
>>> Also, I'm searching RTF files. which have HTML coding behind them. Is
>>> there anyway to have Perl search just the text and not the code?

>> you would need to parse the file using one of the many HTML parsing modules.
>>
>>
>>
>>> Thanks.

>> --
>> -brian

>
> Oh, OK. Yes, I want to treat the "$" as a string literal, and the
> backslash allowed me to do that. Would you provide me with the options
> that are available when using search? Yes, I forgot to mention that
> that's the name of the program. Search is a batch file found in /Perl/
> bin, but I can't find instruction for it with perldoc.


I'd start with search -help. If you look at the code, all the
documentation is within the file.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Command line option syntax error. Type Command /? for Help chuckcar Computer Support 11 04-21-2009 09:59 PM
Re: Command line option syntax error. Type Command /? for Help Evan Platt Computer Support 1 04-18-2009 10:17 PM
Run Unix shell command $ parse command line arguments in python rkoida@yahoo.com Python 4 04-23-2005 04:42 AM
Need simple command for validating xml files at the command line Bernd Oninger XML 1 07-07-2004 06:20 PM
RUN/execute a Command-Line command from an ASP page. Lucas Cowald ASP .Net 4 10-23-2003 11:09 AM



Advertisments