Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Sed in perl

by SBECK (Chaplain)
on Oct 11, 2018 at 12:48 UTC ( [id://1223864]=note: print w/replies, xml ) Need Help??


in reply to Sed in perl

It's hard to see spaces, so I'll replace spaces with underscores for clarity.

In your first example, it looks to me like you're doing:

   $mod = "ABC_";
   $hier = `tac temp.xx | sed -n '/$mod_/,/YYY/ p'| grep XXX`
so with the substitution, your second line is actually:
   $hier = `tac temp.xx | sed -n '/ABC__/,/YYY/ p'| grep XXX`
If I'm misreading the spaces, I apologize, but it appears to me that you're looking for ABC followed by 2 spaces. In the shell command, you're only looking for 1 space.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-16 09:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found