Archive for August, 2007

Here I specified set2 as the space character (Web page design)

Tuesday, August 21st, 2007

Here I specified set2 as the space character because words separated by the characters in set1 need to remain separate after the punctuation is removed. Notice that the characters [ and ] are given as [ and ]. As you will see later in this chapter, these two characters have a special meaning in tr and need to be escaped using the backslash character ( ) in order to be handled correctly. At this point most of the words are separated by spaces, but some of the words are separated by tabs and newlines. To get an accurate count, all the words should be separated by spaces, so you need to covert all tabs and newlines to spaces: $ tr ‘!?”:;[]{}(),.tn’ ‘ ‘ < /home/ranga/docs/ch15.doc The next step is to transliterate all capitalized versions of words to a lowercase version because the words To and to, The and the, and Files and files are really the same word. To do this, you tell tr to change all the capital characters 'A-Z' into lowercase characters 'a-z' as follows: $ tr '!?":;[]{}(),.tn' ' ' < /home/ranga/docs/ch15.doc | tr 'A-Z' 'a-z' I broke the command into two lines, with the pipe character as the last character in the first line so that the shell does the right thing and uses the next line as the command to pipe to. This makes it easier to read and cut and paste, also. Note - Differences between tr versions In this example, you are using a single space for set2. Most versions of tr interpret this to mean transliterating all the characters in set1 to a space. Some versions of tr do not do this. You can determine whether your tr works in this manner using the test code: $ echo "Hello, my dear!" | tr ',!' ' ' Most versions of tr produce the following output: Hello my dear Some versions produce the following output instead: Hello my dear! To obtain the desired behavior from these versions of tr, make sure that set1 and set2 have the same number of characters. In this case, set2 needs to contain two spaces: $ echo "Hello, my dear!" | tr ',!' ' ' In the case of the sample problem, set2 would need to contain 15 spaces.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Sams Teach Yourself Shell (Vps web hosting) Programming in 24 Hours

Monday, August 20th, 2007

Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 15: Text Filters Previous Chapter Next Chapter Sections in this Chapter: The head and tail Commands Summary Using grep Questions Counting Words Previous Section Next Section Counting Words The tr Command Sorting Numbers The sort Command Using Character Classes with tr The uniq Command Counting words is an essential capability in shell scripts. There are many ways to do it, with the easiest being the wc command. Unfortunately, it displays only the number of characters, words, or lines. What about when you need to count the number of occurrences of word in a file? The wc command falls short. In this section, you will solve this problem using the following commands: l tr l sort l uniq The tr command ( tr for transliterate) changes all the characters in one set into characters in a second set. Sometimes it deletes sets of characters. The sort command sorts the lines in an input file. If you don’t specify an input file, it sorts the lines given on STDIN. The uniq command ( uniq for unique) prints all the unique lines in a file. If a line occurs multiple times, only one copy of the line is printed out. It can also list the number of times a particular line was duplicated. I will use the text of this chapter, ch15.doc, as the input file for this example. The tr Command First, you need to eliminate all the punctuation and delimiters in the input file because the word end. and the word end are the same. You accomplish this task using the tr command. Its basic syntax is tr ’set1′ ’set2′ Here tr takes all the characters in set1 and transliterates them to the characters in set2. Usually, the characters themselves are used, but the standard C language escape sequences also work. To accomplish my first task, I used the following command: $ tr ‘!?”:;[]{}(),.’ ‘ ‘ < /home/ranga/docs/ch15.doc
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

pqops.c:/* Function to delete a node from the (Web host sites)

Sunday, August 19th, 2007

pqops.c:/* Function to delete a node from the heap. Adapted from Introduction pqops.c:void heap_delete(binary_heap *a,int i) { pqops.c: node deleted; pqops.c: /* return with an error if the input is invalid, ie trying to delete pqops.c: sprintf(messages,”heap_delete(): %d, no such element.”,i); pqops.c: /* switch the item to be deleted with the last item, and then pqops.c: deleted = a->elements[i]; pqops.c: /* (compare_priority(a->elements[i],deleted)) ? heap_up(a,i) : heap_down(a,i); */ pqops.h:extern void heap_delete(binary_heap *a,int i); scheduler.c: /* if the requested id is in the heap, delete it */ scheduler.c: heap_delete(&my_heap,node_num); As you look at the output, you see that only three files — pqops.c, pqops.h, and scheduler.c –contain the word delete. Here you had to generate a list of matching lines and then manually look at the filenames in which those lines were contained. By using the -l option of the grep command, you reach this conclusion much faster. For example, the following command $ grep -l delete * pqops.c pqops.h scheduler.c produces the list you wanted. Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 15: Text Filters Previous Chapter Next Chapter Sections in this Chapter: The head and tail Commands Summary Using grep Questions Counting Words Previous Section Next Section Copyright Macmillan Computer Publishing. All rights reserved.
We recommend high quality webhost to host and run your jsp application: christian web host services.

$ /bin/ps -ef | grep bash | (Web site construction) grep

Saturday, August 18th, 2007

$ /bin/ps -ef | grep bash | grep -v grep This removes the extraneous output: ranga 3277 3276 0 13:41:45 pts/t0 0:02 -bash Line Numbers As grep looks through a file for a given word, it keeps track of the line numbers that it has examined. You can have grep list the line numbers along with the matching lines by specifying the -n option. With this option the output format is file:line number:line Here file is the name of the file in which the match occurs, line number is the line number in the file on which the matching line occurs, and line is the complete line that contains the specified word. For example, the command $ grep -n pipe ch15.doc ch15-01.doc produces the following output: ch15.doc:969:I’ve broken the command into two lines, with the pipe character as the ch15.doc:971:the right thing and use the next line as the command to pipe to. It’s ch15.doc:1014:The first few lines look like (ten actually, I piped the output to ch15-01.doc:964:I’ve broken the command into two lines, with the pipe character as the ch15-01.doc:966:the right thing and use the next line as the command to pipe to. It’s ch15-01.doc:1009:The first few lines look like (ten actually, I piped the output to As you can see, the lines might be the same in both files, but the line numbers are different. Listing Filenames Only Sometimes you don’t really care about the actual lines in a file that match a particular word. You want a list of all the files that contain that word. For example, the following command looks for the word delete in all the files in my projects directory: $ grep delete /home/ranga/docs/projects In my case, it produces the following output:
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

unix has several additional pieces of (Web hosting rating) information associated

Friday, August 17th, 2007

unix has several additional pieces of information associated with it. unix counterparts, but implement a few nice options which makes their unix files names, but they are, and handling them correctly is Reading From STDIN When no files are specified, grep looks for matches on the lines that are entered on STDIN. This makes it perfect for attaching to pipes. For example, the following command looks for all users named ranga in the output of the who command: $ who | grep ranga ranga tty1 Aug 26 14:12 ranga ttyp2 Nov 23 14:15 (rishi.bosland.u) The -v Option Most of the time you use grep to search through a file looking for a particular word, but sometimes you want to acquire a list of all the lines that do not match a particular word. Using grep, this is simple –specify the -v option. For example, the following command produces a list of all the lines in /etc/passwd that do not contain the word home: $ grep -v home /etc/passwd On my system, the output looks like the following: root:*:0:3::/:/sbin/sh daemon:*:1:5::/:/sbin/sh bin:*:2:2::/usr/bin:/sbin/sh sys:*:3:3::/: adm:*:4:4::/var/adm:/sbin/sh uucp:*:5:3::/var/spool/uucppublic:/usr/lbin/uucp/uucico lp:*:9:7::/var/spool/lp:/sbin/sh nobody:*:-2:-2::/: One common use of the -v option is to parse the output of the ps command. For example, if I were looking for all instances of bash that were running on a system, I could use the following command: $ /bin/ps -ef | grep bash Sometimes the output looks like the following: ranga 3277 3276 2 13:41:45 pts/t0 0:02 -bash ranga 3463 3277 4 18:38:26 pts/t0 0:00 grep bash The second process in this list is the grep that I just ran. Because it is not really an instance of bash, I can get rid of it as follows:
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

ch15.doc:the right thing and use the (Web design portfolio) next line

Thursday, August 16th, 2007

ch15.doc:the right thing and use the next line as the command to pipe to. It’s ch15.doc:The first few lines look like (ten actually, I piped the output to ch15-01.doc:I’ve broken the command into two lines, with the pipe character as the ch15-01.doc:the right thing and use the next line as the command to pipe to. It’s ch15-01.doc:The first few lines look like (ten actually, I piped the output to As you can see, the name of the file precedes each line that contains the word pipe. If grep cannot find a line in any of the specified files that contains the requested word, no output is produced. For example, $ grep utilities ch16.doc produces no output because the word utilities does not appear in the file ch16.doc. Case Independent Matching One of the features of grep is that it matches the specified word according to the case that you specify. In grep, the word Apple is different than the word apple. Sometimes you want to match words regardless of the case that you specify. To do this, use the -i option. For example, the command $ grep unix ch16.doc produces the output: all unix users. The GNU versions of these commands support all the unix has several additional pieces of information associated with it. unix counterparts, but implement a few nice options which makes their unix files names, but they are, and handling them correctly is On the other hand, the command $ grep UNIX ch16.doc produces different output: GNU stands for GNU’s not Unix and is the name of a Unix-compatible Project utilities are the GNU implementation of familiar Unix programs By using the -i option, you get the sum of both of these commands: $ grep -i unix ch16.doc GNU stands for GNU’s not Unix and is the name of a Unix-compatible Project utilities are the GNU implementation of familiar Unix programs all unix users. The GNU versions of these commands support all the
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

1 on 1 web hosting - Sams Teach Yourself Shell Programming in 24 Hours

Wednesday, August 15th, 2007

Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 15: Text Filters Previous Chapter Next Chapter Sections in this Chapter: The head and tail Commands Summary Using grep Questions Counting Words Previous Section Next Section Using grep Looking for Words Line Numbers Reading From STDIN Listing Filenames Only The grep command lets you locate the lines in a file that contain a particular word or a phrase. The word grep stands for globally regular expression print. The command is derived from a feature of the original UNIX text editor, ed. To find a word in ed, the following command was used: g/word/p Here word is a regular expression. For those readers who are not familiar with regular expressions, Chapter 16, “Filtering Text Using Regular Expressions,” discusses them in detail. This particular ed command was used widely in shell scripts, thus it was factored into its own command called grep. In this section, you will look at the grep command and some of its most commonly used options. Looking for Words The basic syntax of the grep command is grep word file Here file is the name of a file in which you want to search for word. The grep command displays every line in file that contains word. When you specify more than one file, grep precedes each of the output lines with the name of the file that contains that line. As an example, the following command locates all the occurrences of the word pipe in file ch15.doc (this chapter): $ grep pipe ch15.doc I’ve broken the command into two lines, with the pipe character as the the right thing and use the next line as the command to pipe to. It’s The first few lines look like (ten actually, I piped the output to If I specify more than one file the output changes as follows: $ grep pipe ch15.doc ch15-01.doc ch15.doc:I’ve broken the command into two lines, with the pipe character as the
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

The follow Option An extremely useful feature of (Web hosting services)

Tuesday, August 14th, 2007

The follow Option An extremely useful feature of the tail command is the -f ( f as in follow) option: tail -f file Specifying the -f option enables you to examine the specified file while programs are writing to it. Often I have to look at the log files generated by programs that I am debugging, but I don’t want to wait for the program to finish, so I can start the program and then use tail -f for the log file. Some Web administrators use a command such as the following to watch the HTTP requests made for their system: $ tail -f /var/log/httpd/access_log Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 15: Text Filters Previous Chapter Next Chapter Sections in this Chapter: The head and tail Commands Summary Using grep Questions Counting Words Previous Section Next Section Copyright Macmillan Computer Publishing. All rights reserved.
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

index.html RCS humor misc downloads The tail Command (Web design course)

Monday, August 13th, 2007

index.html RCS humor misc downloads The tail Command The basic syntax for the tail command is similar to that of the head command: tail [-n lines] files Here files is the list of the files the tail command should process. Without the -n lines option, the tail command shows the last 10 lines of its standard input. With this option it shows the specified number of lines instead. To illustrate the use of the tail command, consider the problem of generating a list of the five oldest mail spools on my system. I can start with ls -1 command again, but this time I’ll use the -t (sort by last modified time) option instead: $ ls -1t /var/spool/mail To get the bottom five, I’ll use tail instead of head: $ ls -1t /var/spool/mail | tail -5 On my system the following list is generated: anna root amma vathsa ranga In this list, the files are listed from newest to oldest. To reverse the order, I can also specify the -r option to the ls command: ls -1rt /var/spool/mail | tail -5 On my system, I get this list: ranga vathsa amma root anna
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Here files is the list of the files (Web design programs)

Sunday, August 12th, 2007

Here files is the list of the files you want the head command to process. Without the -n lines option, the head command shows the first 10 lines of its standard input. This option shows the specified number of lines instead. Although this command is useful for viewing the tops of large README files, its real power happens in daily applications. Consider the following problem. I need to generate a list of the five most recently accessed files in my public HTML files directory. What is the easiest solution? It’s easy to devise a solution by breaking the problem down. First, I generate a list of my public HTML files using the following command: $ ls -1 /home/ranga/public_html In my case, this generates the following list of files and directories: RCS cgi-bin downloads humor images index.html misc projects school Next, I need to sort the list by the date of the last access. I can do this by specifying the -ut (sort by last accessed time) option to the ls command: $ ls -1ut /home/ranga/public_html The output now changes as follows: RCS humor misc downloads images resume projects school cgi-bin index.html To retrieve a list of the five most recently accessed files, I can pipe the output of the ls command into a head command: ls -1ut /home/ranga/public_html | head -5 This produces the following list:
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.