Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Must have CLI of Perl's sed's n command

by Fletch (Bishop)
on Jun 30, 2022 at 02:02 UTC ( [id://11145183]=note: print w/replies, xml ) Need Help??


in reply to Must have CLI of Perl's sed's n command

Your formatting is kind of terrible, but you can check $. and skip if the first line (next if $. == 1). Another option might be to use the trick of using -M and a version to get something to run before the magical while wrapping the -n does. Use something like -M5.010’;scalar <>;’ to have the first line read (and discarded).

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Must have CLI of Perl's sed's n command
by LanX (Saint) on Jun 30, 2022 at 02:34 UTC
    > Your formatting is kind of terrible,

    yep, that's one way to express it.

    > skip if the first line (next if $. == 1)

    If that's the goal (???) $.-1 is false for the first line only, he could && it with the flip-flop's start condition.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^2: Must have CLI of Perl's sed's n command
by abdan (Acolyte) on Jun 30, 2022 at 02:10 UTC
    seems we to conclude there's none, as
    next if $_ == ...
    is different; costlier & less eff. - i got/knew it in first place
      $_ and $. are not the same thing.

      Could you show the sed example you're trying to mimic? I'm not sure I understand.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-25 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found