Hello, hello everyone. It is I, back again, to go over some more useful commands in Linux! Or rather, in UNIX shells, such as ksh.
First off, we're going to go over one of my favorite commands, <b>sed</b>sed stands for <b>S</b>tream <b>ED</b>itor, and that is just what it does, it takes a stream of text and edits it based upon options you give. There are multiple command options to give, but I'm not going to give them, I'm just going to list the basic use of sed. Let's try a command line.Boot up your shell, if you have one, if you're using windows, go download what I used, <a href="http://www.research.att.com/~gsf/download/tgz/uwin-base.2006-02-14.win32.i386.exe">U/WIN</a>NOTE: It will ask for a username and a password, give these for username and password:Username: I accept www.opensource.org/licenses/cplPassword: .(That's a single period.)Now, let's run our command, which is one that I run often just to waste time.sed s/[AaEeIiOoUu]/*/gNOTE: That is not a normal slash before the *, it's a backslash, which is used to label the path to a file in an NTFS environment, such as C:. Anyways, the prompt will disappear. Type anything, then press enter. It will echo it back, but replace all vowels with an asterisk. I know it's pointless, but it shows possibility. You'll note the letters between the [ and ]. That's a pattern, it means any letters that match those. There are other patterns, such as:[:alnum:] all letters and digits [:alpha:] all letters [:blank:] all horizontal whitespace [:cntrl:] all control characters [:digit:] all digits [:graph:] all printable characters, not including space [:lower:] all lower case letters [:print:] all printable characters, including space [:punct:] all punctuation characters [:space:] all horizontal or vertical whitespace [:upper:] all upper case letters [:xdigit:] all hexadecimal digitsI got all of those from the man file for tr, which is what we're going to talk about next.tr, which means <b>TR</b>anslate, is a little program that translates certain characters into other characters when they occur. Unlike many other things, tr can not open a file, so it's best to redirect output of something to it, or rather, PIPE it, which I will discuss in a moment. Let's look at a basic tr command.Make a text file that contains one line, that says: Monday 1 2 3 4 5.Name it ex.txt, then run the following command:cat [path to ex.txt] | tr a-z A-Z | tr 1-9 0 > ex.txt,Then type cat ex.txt, and note how it changed.Now, on to piping and redirection, one of my favorite parts.Say you have a command, but you want to supress it's output, and send it elsewhere. Well, here's how you do it. [command] > pathOR[command] >> pathThe difference between the two is, the first one overwrites everything in the file that was there beforehand. ALso, if you just want to completely throw everything away, just do, [command] > /dev/nullThat just tosses it into computer oblivion.Just as well, there is input redirection. Say you have a file that contains information a program needs. Simple,[command] < fileYou just redirect what's in the file into the command!And finally, piping. Say you have one program that shows a lot of output, but you only want to view it one chunk at a time. Simple. Just do this: [command] | more | is the <i>Pipe</i> operator, it takes the output of the previous command, and pipes it to the next one. Nifty, I know. Note that it is typed by pressing the forward-slash key while holding shift. Just for those people who didn't know.There are all sorts of filter programs to use, programs that you pipe output into, such as tr, sed, grep, more, less… Try and find them all out.This is MahFreenAmeh, out.~
wow what a fucking useless post
Again, I agree with SJF.
Okay then, REZ.
The only reason that this is any good at all is the word Linux.
Useful-ish. But kind cool. I alreadh know some bash commands, are they any different to the ones in the shell you're talking about?