Quote:
Originally Posted by
matrixmadhan
had perl been there in the list it would do everything
Yes ... slowly. ;-))
I don't want to indulge into the perl-as-a-language-discussion. Suffice it to say that the discussion taking place is enough to make me wary about it. Being
disputable is a sign of being problematic regardless of the dispute being carried out or not.
Regarding the thread openers question: sed and awk are tools for different purposes and the question which one to learn makes about as much sense as the question "should i learn the hammer or the nail tool". You will need both.
It is quite common to misuse one tool for a purpose where the other would be better suited. That doesn't make the practice any better - just more common.
To find out which tool to use for which purpose just look at their differences: sed is faster and smaller than awk. awk, on the other hand, is able to work context-sensitive and has a much bigger function library. As a rule of thumb: if you can do it in sed, than do it in sed, in any other case use awk. If you have a line-oriented file and you want to parse out some values from each line and create a nicely aligned table probably sed will be the right tool for you. If you want to sum on one of the fields and write the total in the last line your tool of choice is awk.
If the problem you are trying to solve involves lots of processing you might save a lot of time using sed instead of awk. If the problem is complex and interdependent you might be able to solve it with awk easily and straightforwardly but only with a lot of "programming magic" (if at all) with sed. Bottom line: use every tool for what it is designed to achieve. "One size fits all" is as bad a concept when it comes to chosing tools as it is with condome sizes.
I hope this helps.
bakunin