On 1/22/07, Adriano Allora <[EMAIL PROTECTED]> wrote:

<       NOM     <unknown>
anth    NOM     <unknown>
 >       NOM     <unknown>

Those lines have tab characters, maybe?

perl -pi -e "s/<       NOM     <unknown>.anth    NOM     <unknown>.>
    NOM     <unknown>/<anth>/gis" corpus.txt

The -p option is useful for doing some simple processing in one-liners
like this, but it works on just one line at a time. You can easily
work around that, if you've got small files and big memory, by telling
it to read entire files as lines; see the -0777 option in perlrun.

To match one or more whitespace characters in your pattern, use /\s+/
. Then you won't have to worry about whether they're spaces or tabs,
or even newlines -- so you won't need /s either.

Does that get you closer to a solution? Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to