Red Hat Certified Technician

Processing Text Streams and Files Video Training - Tutorial

Processing Text Streams and Files 1

Would you like to view the full sized version of these tutorials and find out more information about the exciting range of training products on offer.
Hide Caption
In this movie we take a quick look at three commands which can help you make the most of your text files. Grep, Sed, and Awk, they process text streams, they take a look inside files. Let's look at these one by one. The Grep command searches inside files, it reads them and then prints out lines matching a pattern. For example if you're looking for all users named Mike you could use Mike as a search term on the password database file. The output includes all users information associated with the word Mike. Naturally you can make the search more complex. Let's use my full name as a search term and it returns the one username with my full name. Note how I put quotes around the search term Mike Jang, let's see what happens if I take off the quotes. Grep searches for the term Mike in the file name Jang which doesn't exist so Grep complains and then it searches for the term Mike in the password database file. Next let's look at the Sed command it's a stream editor which can transform input from one file to output in another file. We want to transform the file name OS. Let's take a look at it. That's not what we want to see, it would be better if we substituted the word corvalt's or the word gates, with the stream command that's easy. We substitute for the word gates, the word corvalt's, we take the stream from the file named OS and direct the output to the file named BestOS. Now let's look inside the BestOS file. Isn't that better? Next the Awk command, it's more of a database manipulation tool, it allows you to identify the line with a keyword and then read out the text from a specified column. But you absolutely don't need a word. Take this Awk command for example. It uses the colon as shown in quotes as noted with a dash shef option. The colon is thus specified as glemdor, in other words it specifies the different columns. If you forget how that works look at ETC password, you see each column is delimited by colons, now back to the Awk command. When you use the colon as a delimiter and say OK let's print out the first column what do you get but a list of usernames. And as you remember that's from the first column of ETC password. You can further delimit the output using Mike as a search term. And you can the two usernames associated with the word Mike. Thank you and on to the next tutorial.

Red Hat Certified Technician

Michael Jang

US$ 99.95

7 hours - 103 Movies

Win Vista XP 2000,ME. Mac OS X

Ground / 2 day / Next Day

33785

170 In Stock


Apex Web Media ( Hyperteach )
P.O Box 398 Bolton BL7 9YS, United Kingdom.
Tel: +44 (0) 1204 592071
Fax: +44 (0) 1204 592092
Email:


Apex Web Media ( Hyperteach )
600 17th Street, Suite 2800, Denver CO 80202
Tel: Toll free 1866 402 1903 (USA) / 434 878 4158
Fax: 1 207 433 4356
Email: