I know how to use sed
with grep
, but within Perl the below fails. How can one get sed
to work within a Perl program?
c
Supposedly Larry Wall wrote Perl because he found something that was impossible to do with sed and awk. The other answers have this right, use Perl regular expressions instead. Your code will have fewer external dependencies, be understandable to more people (Perl's user base is much bigger than sed user base), and your code will be cross-platform with no extra work.
Edit: Paul Tomblin relates an excellent story in his comment on my answer. I'm putting it here to increase it's prominence.
"Henry Spencer, who did some amazing things with Awk, claimed that after demoing some awk stuff to Larry Wall, Larry said he wouldn't have bothered with Perl if he'd known." – Paul Tomblin