Article 5DCB7 When both sed and awk will do, which one to chose?

When both sed and awk will do, which one to chose?

by
arifd86
from LinuxQuestions.org on (#5DCB7)
I have the inclination that sed is the lighterweight of the two and thus should be used.

But my sed command uses a wildcard, whereas awk doesn't need to. (However, i don't know if behind the scenes they're both doing regex and thus the search pattern in itself is of equal speed)

here's what I'm doing: (want to return only the number)
Code:echo ' index: 56' | sed 's/.* index: //'Code:echo ' index: 56' | awk '/index:/{print $2}'edit prepending with time, awk seems to consistently beat sed by 0.001slatest?d=yIl2AUoC8zA latest?i=Mez3Rbw0_Kk:lmDjPdBS9jQ:F7zBnMy latest?i=Mez3Rbw0_Kk:lmDjPdBS9jQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=Mez3Rbw0_Kk:lmDjPdBS9jQ:gIN9vFwMez3Rbw0_Kk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments