Professional Web Applications Themes

How to reinvent grep with perl? (OT: Cygwin grep) - PERL Beginners

> Perl works better than grep because the grep statement you   Well, I think this post will be off-topic, but here's what I found using my Cygwin grep: I created a DOS text file with these contents: this is a test file END END thouou END Some of those ENDs have space characters after them. I ran my cygwin grep on the file: C:\tmp>c:\cyg\bin\grep -n "^ *END *$" testfile No output. I changed the text file to have UNIX line endings, then re-ran the statement: C:\tmp>c:\cyg\bin\grep -n " *END *$" testfile 4: END 6:END 10:END Checking the cygwin mount ...

  1. #1

    Default RE: How to reinvent grep with perl? (OT: Cygwin grep)

    > Perl works better than grep because the grep statement you  

    Well, I think this post will be off-topic, but here's what I found using
    my Cygwin grep:

    I created a DOS text file with these contents:
    this
    is a test
    file
    END

    END


    thouou
    END

    Some of those ENDs have space characters after them. I ran my cygwin
    grep on the file:

    C:\tmp>c:\cyg\bin\grep -n "^ *END *$" testfile

    No output.

    I changed the text file to have UNIX line endings, then re-ran the
    statement:

    C:\tmp>c:\cyg\bin\grep -n " *END *$" testfile
    4: END
    6:END
    10:END

    Checking the cygwin mount table, I have the following:
    $ mount
    C:\cyg\bin on /usr/bin type system (binmode)
    C:\cyg\lib on /usr/lib type system (binmode)
    C:\cyg on / type system (binmode)
    c: on /c type system (binmode)
    d: on /mnt/d type system (binmode,noumount)
    e: on /mnt/e type system (binmode,noumount)

    So for kicks I switched the text file back to DOS line endings, and
    added the following text mount point:
    mount -ts c:\\ /c_text

    C:\tmp>c:\cyg\bin\grep -n " *END *$" testfile

    C:\tmp>c:\cyg\bin\grep -n " *END *$" /c_text/tmp/testfile
    4: END
    6:END
    10:END

    Voila. That's most likely your problem - a mismatch between line endings
    and Cygwin mount point type.
    Luke Guest

  2. #2

    Default Re: How to reinvent grep with perl? (OT: Cygwin grep)

    "Bakken, Luke" <com> writes:
     

    And in case you hadn't seen them before... there are at least a few
    sets of unix tools for dos/windows. Cygwin maybe the best known but
    I've used Uwin myself for sometime and never had a problem with its
    grep.

    http://www.research.att.com/sw/tools/uwin/

    Harry Guest

  3. #3

    Default RE: How to reinvent grep with perl? (OT: Cygwin grep)

    > > Voila. That's most likely your problem - a mismatch between  
    >
    > And in case you hadn't seen them before... there are at least a few
    > sets of unix tools for dos/windows. Cygwin maybe the best known but
    > I've used Uwin myself for sometime and never had a problem with its
    > grep.
    >
    > http://www.research.att.com/sw/tools/uwin/[/ref]

    And another suggestion:

    http://gnuwin32.sourceforge.net
    Luke Guest

  4. #4

    Default Receve and forward email

    Hi all

    This is my first question.

    One part of my job is to read one e-mail from Pop3 and do a forward of that
    e-mail with SMTP to +- 1000 users, just changing the from and the to.

    There is something that can eseally do this?
    How to do this?

    Probably there is some modules that can do this work ease, but where to start?

    thanks
    Marcos







    O SAPO já está livre de vírus com a Panda Software, fique você também!
    Clique em: http://antivirus.sapo.pt
    Marcos Guest

  5. #5

    Default Re: Receve and forward email

    From: pt 

    To receive:
    Mail::POP3Client or Net::POP3

    To send:
    Net::SMTP, Mail::Sender, MIME::Lite, ...

    Since you just need to forward the email, Net::SMTP should be enough.
    You'll just need to replace the From and To headers (and maybe do
    something more with the message headers) and then transfer the data.

    Jenda
    ===== cz === http://Jenda.Krynicky.cz =====
    When it comes to wine, women and song, wizards are allowed
    to get drunk and croon as much as they like.
    -- Terry Pratchett in Sourcery

    Jenda Guest

Similar Threads

  1. How to reinvent grep with perl?
    By Siegfried in forum PERL Beginners
    Replies: 7
    Last Post: October 10th, 10:06 AM
  2. grep in perl
    By mk76@buffalo.edu in forum PERL Beginners
    Replies: 2
    Last Post: July 16th, 12:26 PM
  3. using grep in perl
    By Andrew Gaffney in forum PERL Beginners
    Replies: 3
    Last Post: February 3rd, 05:03 PM
  4. perl grep..
    By John W. Krahn in forum PERL Beginners
    Replies: 0
    Last Post: January 16th, 11:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139