Search.bat from the command line

Discussion in 'Perl Misc' started by bdy120602@gmail.com, Jun 17, 2008.

  1. Guest

    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.
     
    , Jun 17, 2008
    #1
    1. Advertising

  2. 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
     
    Brian Helterlilne, Jun 17, 2008
    #2
    1. Advertising

  3. Guest

    On Jun 17, 5:53 pm, Brian Helterlilne <> wrote:
    > 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.
     
    , Jun 18, 2008
    #3
  4. wrote:
    > On Jun 17, 5:53 pm, Brian Helterlilne <> wrote:
    >> 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.
     
    Brian Helterlilne, Jun 18, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Brogden
    Replies:
    3
    Views:
    1,930
  2. Chris
    Replies:
    1
    Views:
    1,542
    Chris
    Apr 7, 2004
  3. Replies:
    0
    Views:
    619
  4. Replies:
    0
    Views:
    379
  5. Abby Lee
    Replies:
    5
    Views:
    450
    Abby Lee
    Aug 2, 2004
Loading...

Share This Page