Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When should I ignore sed and use Awk or Perl instead?

awk Perl SED
0
Posted

When should I ignore sed and use Awk or Perl instead?

0

If you can write the same script in Awk or Perl and do it in less time, then use Perl or Awk. There’s no reason to spend an hour writing and debugging a sed script if you can do it in Perl in 10 minutes (assuming that you know Perl already) and if the processing time or memory use is not a factor. Don’t hunt pheasants with a .22 if you have a shotgun at your side . . . unless you simply enjoy the challenge! Specifically, if you need to: – heavily comment what your scripts do. Use GNU sed, awk, or perl. – do case insensitive searching. Use gsed302, sedmod, awk or perl. – count fields (words) in a line. Use awk. – count lines in a block or objects in a file. Use awk. – check lengths of strings or do math operations. Use awk or perl. – handle very long lines or need very large buffers. Use gsed or perl. – handle binary data (control characters). Use perl (binmode). – loop through an array or list. Use awk or perl. – test for file existence, filesize, or fileage. Use perl or shell. – treat

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123