📜 ⬆️ ⬇️

Teacher Foo and command line utilities

Newbie Unix came to teacher Foo and said: “I am in doubt. The Unix Great Path tells us that every program should focus on one thing and do it really well, right? ”

Teacher Foo nodded.

Rookie continued: “The Great Unix Path tells us that the bike doesn't need to be reinvented twice, right?”
')
Teacher Foo nodded again.

“Then why are there several tools with similar word processing capabilities: sed , awk and Perl ? Which one of them will I better comprehend the Great Way of Unix? ”

Teacher Foo asked the newcomer: “What tool will you choose to create a copy of a text file with the replacement of several words?”

The newbie frowned and said, “ Perl ’s regular expressions would be like using a gun to shoot at sparrows. I don't know awk and write scripts on sed . Since I already have some experience using it, I would prefer it. But if this task of replacing text needs to be performed only once and there is no need to perform it constantly, then a text editor will be more than enough. ”

Teacher Foo nodded and said, “Eat when you are hungry. Drink when you are thirsty. Sleep when you're tired. ”

Upon hearing this, the novice attained enlightenment.

Source: https://habr.com/ru/post/106853/


All Articles