Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

sed in perl script

by som.nitk (Novice)
on Feb 23, 2010 at 19:55 UTC ( #824932=perlquestion: print w/ replies, xml ) Need Help??
som.nitk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have a config file as follows:
[Dummy1] Sun 0000-2359 Mon 0000-0859;1830-2359 Tue 0000-2359;1830-2359 Wed 0000-2359;1830-2359 Thu 0000-2359;1830-2359 Fri 0000-2359;1830-2359 Sat 0000-2359 [Dummy2] Sun 0000-2359 Mon 0000-0859;1830-2359 Tue 0000-2359;1830-2359 Wed 0000-2359;1830-2359 Thu 0000-2359;1830-2359 Fri 0000-2359;1830-2359 Sat 0000-2359 [Dummy3] Sun 0000-2359 Mon 0000-0859;1830-2359 Tue 0000-2359;1830-2359 Wed 0000-2359;1830-2359 Thu 0000-2359;1830-2359 Fri 0000-2359;1830-2359 Sat 0000-2359
I want to select lines between tags, say between Dummy1 and the new line. I have tried to use sed in side perl script but it does not work. Can anyone tell me how to select lines between tags using sed/awk inside perl script?

Comment on sed in perl script
Download Code
Re: sed in perl script
by Corion (Pope) on Feb 23, 2010 at 20:05 UTC

    Perl works better when you use it as Perl and not as a shell script tying together sed and awk.

    Maybe you can show us what code you've already written.

    Note that many sed commands exist in Perl as well, most notably s///.

    Note that many awk commands exist in Perl as well, most notably, print.

Re: sed in perl script
by clp (Friar) on Feb 23, 2010 at 22:34 UTC
    Perhaps the perldoc for s2p (sed-to-Perl) would give you a quick intro to Perl, by translating your sed commands.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://824932]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2015-07-04 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls