Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Succint Perl version of Awk

by kcott (Archbishop)
on May 30, 2023 at 14:12 UTC ( [id://11152520]=note: print w/replies, xml ) Need Help??


in reply to Succint Perl version of Awk

G'day Galdor,

TMTOWTDI:

$ echo "one two three four five six seven eight nine A B C D E F G H A B C D E F G H I J" | perl -pe 's/^(?:\s*\S+\s+){3}//' four five six seven eight nine D E F G H D E F G H I J

Update: Added a '^' anchor to the regex.
Was: s/(?:\s*\S+\s+){3}//
Now: s/^(?:\s*\S+\s+){3}//
It doesn't change the result; but looks more correct.
With a huge history file, it might be a little quicker.

— Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11152520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found