On Jun 28, 11:18 am, [EMAIL PROTECTED] (Luca Villa) wrote:
> I have a long text file like this:
>
> 324yellow
> 34house
> black
> 54532
> 15m21red56
> 44dfdsf8sfd23
>
> How can I obtain (Perl - Windows/commandline/singleline) the
> following?
>
> 1) only the numbers at the beginning before some alpha text, like
> this:
>
> 324
> 34
> 15
> 44
>
> 2) only the numbers within the alpha text, like this:
>
> 21
> 8
>
> 3) only the numbers at the end after some alpha text, like this:
>
> 56
> 23

perl -F'(\D+)' -lane'$,="|";[EMAIL PROTECTED]' data.txt
324|yellow
34|house
|black
54532
15|m|21|red|56
44|dfdsf|8|sfd|23

--
Brad


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


Reply via email to