One of the best investments you can make -- after you've devoured the list that Onebuck gave you and gotten familiar with how things work -- is to take the time to dig into regular expressions.
Huh?
As time goes on, you'll find that the Click 'n' Drool School will get boring, applications will start to feel limited, you'll want to do something or other and you'll want to be able to do more. Linux, the operating system itself is Linux all the rest are the utilities, will, once you've got things configured, become invisible; you start it up, it sits there mumbling to itself, and you don't need to tinker with it.
So, then what do you do?
Well, say a little light bulb pops on over your head and you think to yourself, "Wow! How can I make that happen?" And that's where all the utilities begin to look interesting.
Virtually all the tools and utilities sitting there are for you to use to accomplish something quickly and easily. And all of them started out life as part of Unix, developed by a bunch of Really Smart Folks at AT&T Bell Laboratories. They built the tools to make what they were doing (essentially reinventing computer programming) easier. Ain't no easy, but there's a whole lot of easier.
The Unix utilities got migrated to Linux as look-work-alike utilities developed by the Free Software Foundation (that's GNU) and contributors all over the world that saw a Good Thing and help migrate that to free and open source. Linux itself, the kernel, was developed by Linus Torvalds because he liked Unix but couldn't afford to buy a license for it so he developed a look-work-alike that we now have in hand.
One of those Really Smart Folks is M. Douglas McIlory, a Bell Labs scientist (the guy that invented the Unix pipe, no small contribution) who postulated what has become known as the Unix Philosophy
http://en.wikipedia.org/wiki/Unix_philosophy:
Quote:
This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.
|
The essence of which is: Write programs that do one thing and do it well.
The question, then, is "OK, how?"
Always keep in mind that everything hangs together -- the utilities, the tools, do work together. The output of one can be the input to another which, in turn, can output into the input of yet another and so on. That's the beauty of the pipe.
The editors,
ed,
ex,
sed and others are useful as text filters. So too are tools such as
awk,
grep,
sort,
uniq among a plethora of useful tools.
The common denominator of all of these are regular expressions
http://en.wikipedia.org/wiki/Regular_expression:
Quote:
In computing, a regular expression provides a concise and flexible means for "matching" (specifying and recognizing) strings of text, such as particular characters, words, or patterns of characters.
|
When you stop and think about, everything you do with a computer starts out as some form of text; a shell program, a letter to your mom, a C program, data base entries, and on and on. It's all text before it becomes bits and bytes and nibbles. Editing something such as this post is easily done with, oh,
vi --
vi is, by the way, the visual mode of the
ex editor -- but consider editing a 10,000-word document to replace some pattern of text with some other pattern of text, clean out stuff that shouldn't be there (like back slants rather than slashes -- not the same thing at all). Would you want to do that by "hand" or would it be easier to do it using a tool, say,
sed (the streaming editor) using a "...concise and flexible means for "matching" (specifying and recognizing) strings of text..."
Consider a data file of thousands of lines containing hundreds of fields from which you only need the third, tenth and twenty-fifth fields to accomplish some task -- how would you do that? How would you remove all instances of multiple blanks; how would you remove trailing blanks; if you had all upper case text, how would you convert that to lower case but retain the first character of a sentence as upper case; if people's names were all upper case, how would you convert those to lower case but keep the first character as upper case and, oh, by the way, properly deal with Mc, Mac and other mixed case surnames?
All of that, and much, much more, is easily dealt with if you have a good grasp of pipes and filters and, of course, regular expressions. Well worth your time investment, those.
To solve problems with a computer (or, what the heck, pretty much anything else) requires that you have a clear understanding of three things: what have you got; what do you want; what do you have to do to get there. Learning about the tools and what you can do with them is a good use of your time.
Hope this helps some.