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?

Replies are listed 'Best First'.
Re: sed in perl script
by Corion (Patriarch) 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.