On 2010.07.12 10:31, Shlomi Fish wrote:
> On Monday 12 Jul 2010 17:18:12 Steve Bertrand wrote:
>> On 2010.07.09 21:57, Uri Guttman wrote:
>>>>>>>> "SB" == Steve Bertrand <st...@ipv6canada.com> writes:
>>>   SB> On 2010.07.09 21:40, Uri Guttman wrote:
>>>   >> what input? i see none there. but what you want is either -p or -n.
>>>   >> both are among the most useful options for perl oneliners. look
>>>   >> them up in perlrun and pick which one you want.
>>>   
>>>   SB>   | perl -p -e 's/.*\s+//'
>>>
>>> you need to test that one liner all by itself by feeding it some of
>>> those lines. the regex is very wrong as it will delete the entire line
>>> and therefore print nothing. .* matches the whole line before the
>>> newline and \s+ matches the trailing newline. if you added the -l option
>>> too, it would strip the newline off before regex is run and likely will
>>> do what you want. but a better regex is needed. i gotta run so i can't
>>> help with that now.
>>
>> Thanks for the help all, here's what I've come up with:
>>
>> perl -pe 's/(.*?)\s+//'
> 
> Since you're not capturing the first match it should be "(?:.*?)\s+". But 
> here 
> the clustering is redundant so you can just say "s/.*?\s+//".

Agreed. Along with the erroneous '$' in my egrep, the parens should have
been stripped off, as I was trying to bundle things for ease of personal
viewing/testing.

*sigh*

Thanks Shlomi, I forgot completely about ?:

Thankfully, I'm not a Perl Hacker, so I can claim ignorance ;)

Cheers all,

Steve

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to