Archive for July, 2007

Chapter 4 (Make my own web site) . Processing Text 185 Using the

Tuesday, July 31st, 2007

Chapter 4 . Processing Text 185 Using the stream editor The sed utility is a stream editor that takes input either from a file or from data that is piped into the utility. The sed utility works globally within a file unless addressing symbols are used to limit the scope of the command. That the utility works globally means that every instance matching the specified pattern is replaced. Addressing can be used to specify the location that is to be searched for a matching pattern. This addressing can specify either a line or a range of lines in a file. You can also exclude line addresses from the search using the exclamation symbol (!). Regular expressions can also be used to specify locations within a file. The sed command can be used to make simple substitutions and more powerful changes to a file. Simple substitutions throughout a file are made using the following syntax: sed -option s/REGEXP/replacement/flag filename The sed command will work using text from standard input as well as text from specified files. The original file is left intact, and the changes are written to a new file. REGEXPstands for regular expression, which is a way of searching for particular characters. Regular expressions are discussed in the following section. The s command instructs the sed utility to locate the REGEXPand remove that while adding the replacementin its place. You can perform multiple substitutions using the -e option. Two examples of how to use this are: sed -e s/lisa/Lisa/ -e s/nikki/Nikki/ myfriends sed -e s/lisa/Lisa/ ; s/nikki/Nikki/ myfriends These commands search the my friends file and replace the characters lisa and nikki with Lisa and Nikki, respectively. You can also use the sed utility to run a script on a file by using the -f option. This enables you to store frequently used options and simplifies larger commands. The f option is used as shown below: sed -f scriptname filename When used with a script, the script must contain the sed command(s) in the following format: s/REGEXP/replacement/flags The various options for the sed utility are covered in Table 4-17.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

184 Part II . Getting Around in Linux (Web design programs)

Monday, July 30th, 2007

184 Part II . Getting Around in Linux A logical page consists of three sections: header, body, and footer. Any of the sections can be empty. Each can be numbered in a different style from the others. An empty line of output replaces a section separator. Any text that comes before the first section separator string in the input file is considered to be part of a body section, so the nl utility treats a file that contains no section delimiters as a single body section. Several options can be used to customize the output gained using this utility, and several of those options are covered in Table 4-16. Table 4-16 Options Used with nl Option Use -t Numbers only nonempty lines. -n Does not number lines (the default for headers and footers). -i NUMBER Increments line numbers by NUMBER with the default value of one. -p Does not reset line numbers at the start of each logical page. -s STRING Adds the STRING after the added line number. -v NUMBER Sets the initial line number on each logical page to NUMBER. -w NUMBER Specifies the NUMBER of character spaces to reserve for line numbers. The default value is six. -a Numbers all lines. Below is an example of the use the nl utility. In this example the nicks file is printed with a number corresponding to each line. # nl nicks 1 Bammage 2 Rexmortis 3 Jackyl 4 Dragonstr 5 Alchemist 6 Just_joe 7 Johan 8 Sting 9 Dave 10 Thomas 11 Netchick 12 Netjunkie 13 Pri 14 Zaphod 15 Lordram
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Web hosting - Chapter 4 . Processing Text 183 Displaying numeric

Monday, July 30th, 2007

Chapter 4 . Processing Text 183 Displaying numeric details of a file The wc utility counts the number of bytes, white space separated words, and line feed characters in each given file. It prints one line of counts for each file, and if the file was given as an argument, it prints the filename following the counts. If more than one file is given, the utility prints a final line containing the cumulative counts, with the filename total. The counts are printed in this order: line feed characters, words, and bytes. By default, each count is output right-justified in a 7-byte field with one space between fields so that the numbers and filenames line up nicely in columns. Several of the options available with the wc utility are shown below in Table 4-15. Table 4-15 Options Used with wc Option Use -w Displays only the word count. -l Displays only the line count. -L Displays the length of the longest line. –help Displays help information and then exits. –version Displays version information and then exits. -c Displays only the byte count. The following are examples of the use of the wc utility. # wc nameslist 15 30 203 nameslist #wc -c nameslist 203 nameslist #wc -L nameslist 16 nameslist Adding line numbers to a file The nl utility is useful for displaying line numbers in a file. This utility displays a file with line numbers added to each line. The utility breaks its input into logical pages. By default, the line number is reset to 1 at the top of each logical page. It treats all of the input files as a single document and does not reset line numbers or logical pages between files.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Web site developers - 182 Part II . Getting Around in Linux

Sunday, July 29th, 2007

182 Part II . Getting Around in Linux Table 4-13 Options Used with pr Option Use -a Prints columns across rather than down. -d Double-spaces the output. -f Uses form feeds instead of newline characters to separate pages. -h HEADER Uses a centered HEADER instead of the filename as the header. -l PAGELENGTH Sets the number of lines per page to PAGELENGTH. -m Prints all files in parallel, one per column. -N NUMBER Starts counting with NUMBER at first line of first page printed. -w WIDTH Sets page width to WIDTH (default value is 72) characters for multiple text-column output only. -W WIDTH Sets page width to WIDTH (default value is 72) characters always. -COLUMN Produces COLUMN-sized columns and balances the number of lines in the columns on each page. Displaying files backwards The tac utility is used to display lines of a file in reverse where, by default, a new line begins after the line feed character. This is the opposite of the cat command in spelling and function. The syntax for the tac utility is as follows: # tac -options file The options used with this utility are shown in Table 4-14. Table 4-14 Options Used with tac Option Use -r Treats the separator string as a regular expression. -b Attaches the separator to the beginning of the line that precedes it in the file. -s SEPARATOR Uses the SEPARATOR character instead of the line feed character as the record separator.
We recommend high quality webhost to host and run your jsp application: christian web host services.

Web server - Chapter 4 . Processing Text 181 Option Use

Sunday, July 29th, 2007

Chapter 4 . Processing Text 181 Option Use -w BYTES Outputs the specified number of BYTES per line. The default width is 32 bytes. –help Displays help information and exits. –version Displays version information and exits. The following is an example of the use of the od utility. In this example, the nicks file is displayed in hexadecimal format with a width of eight bytes. # od -A x -w8 nicks 000000 060502 066555 063541 005145 000008 062522 066570 071157 064564 000010 005163 060512 065543 066171 000018 042012 060562 067547 071556 000020 071164 040412 061554 062550 000028 064555 072163 045012 071565 000030 057564 067552 005145 067512 000038 060550 005156 072123 067151 000040 005147 060504 062566 052012 b000048 067550 060555 005163 062516 000050 061564 064550 065543 047012 000058 072145 072552 065556 062551 000060 050012 064562 055012 070141 000068 067550 020144 046012 071157 000070 071144 066541 000012 000075 Exam Tip You should pay close attention to these rarely used utilities such as od and join, as they make excellent exam material. Converting files for printing The pr utility formats and prepares files for printing. The prutility writes each file to standard output, paginating and optionally outputting the file in multicolumn format. It also can merge all files, printing all in parallel, one per column. An example of the correct syntax for this utility is as follows: pr -options FILE By default, a five-line header is printed at each page: two blank lines, a line with the date, the filename, and the page count, and two more blank lines. A footer of five blank lines is also printed. Several options can be used to specify the formatting produced with the pr utility. Several of these options are shown in Table 4-13.
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

180 Part II . Getting Around in Linux (Unlimited web hosting)

Saturday, July 28th, 2007

180 Part II . Getting Around in Linux namesac nameslist # cat namesaa Scott Bessler Jason Nash Angie Nash Derek Stutsman Jeff Arellano Displaying files in other formats There are times that you might want to display files in nontext format. For displaying files in octal and other formats, the od utility is useful. Each line of output consists of the offset, which is the number of input bytes skipped before formatting and writing by default in the input. This is followed by groups of data from the file. By default, od prints the offset in octal, and each group of file data is two bytes of input printed as a single octal number. The options for this utility are shown in Table 4-12. Table 4-12 Options Used with od Option Use -A RADIX Specifies the base to use for displaying the file. Any of the following can be used for RADIX: d is used for decimal o is used for octal x is used for hexadecimal n is used for none -j BYTES Specifies the input BYTES to skip before displaying the file. -N BYTES Specifies the maximum BYTES of input to display. -s [N] Instead of the normal output, the string constants are output. This is at least N (3 by default) consecutive ASCII graphic characters, followed by a null (zero) byte. -t TYPE Selects the format in which to output the file data. TYPE is a string of one or more of the following type indicator characters: a is for named character c is for ASCII character or backslash escape d is for signed decimal f is for floating point o is for octal u is for unsigned decimal x is for hexadecimal
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Chapter 4 . Processing Text 179 (Domain and web hosting) Dividing files

Saturday, July 28th, 2007

Chapter 4 . Processing Text 179 Dividing files into multiple pieces The split utility is used to divide one long file into many different files. This utility creates files all of a certain length, with a default length of 1,000 lines, and sequentially names the files. The filenames are made of a prefix, which is x by default, followed by a letter combination. The letter combination follows the pattern of aa, ab, ac, and so on. If there are more than 676 files being created, the syntax used is zaa, zab, and so on. The split utility is capable of using either standard input or a file as input; when no file is specified, standard input is used. The correct syntax when using the split utility is as follows: # split -options INPUTPREFIX Several options, shown in Table 4-11, can be used to customize the output of the split utility. Table 4-11 Options Used with split Option Use -b BYTES Specifies the number of bytes to be placed in each file. If the number is followed by b, the amount is multiplied by 512; if a k is used, the number is multiplied by 1024; and if an m is used, the number is multiplied by 1,048,576. -C BYTES Works like the -b option except as many completed lines of data are placed in the file as possible without exceeding the number of BYTES specified. –verbose Writes diagnostics to standard error before each file is opened. –help Displays help information and exits. –version Displays version information and exits. -l LINES Specifies the number of lines contained in each output file. In the following example the nameslistfile is split into several files each containing five lines. # split -l 5 nameslist names # ls names* namesaa namesab
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

178 Part (Cpanel web hosting) II . Getting Around in Linux

Friday, July 27th, 2007

178 Part II . Getting Around in Linux The correct syntax of the joinutility is shown below. The output produced consists of one line for each pair of input lines. The default join field used is the first line of each file. join -options FILE1 FILE2 Some of the options used with the utility are shown in Table 4-10. Table 4-10 Options Used with join Option Use -1 FIELD Specifies the FIELD in FILE1 to use when joining files. -2 FIELD Specifies the FIELD in FILE2 to use when joining files. -t CHAR Specifies that the character CHAR is to be used as the separator of the input and output fields. -v FILE# Instructs that a line is to be printed for each unpairable line located in the specified FILE#. –help Displays help information and exits. –version Displays version information and exits. -I Specifies that case is to be ignored when combining files. Following is an example of the use of this utility. # cat list_1 drew jason joe john mike todd # cat list_2 derek jason john pete scott # join list_1 list_2 jason john
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Best web design - Chapter 4 . Processing Text 177 Table 4-9

Friday, July 27th, 2007

Chapter 4 . Processing Text 177 Table 4-9 Options Used with tail Option Use +NUMBER Specifies the NUMBER of lines from the beginning of the file to begin with when printing. –retry Instructs the utility to keep trying to open a file even if it is inaccessible. This option must be used with a name and will cause tail to retry even if the file doesn t exist. -c NUMBER Displays the last NUMBER of bytes specified. -f Specifies that tail should run in a loop so that appended data is displayed. This option is used with files that are growing in size because new data is being appended to the end. -n NUMBER Displays the last NUMBER of files specified. -q Specifies that headers are not to be displayed. -v Specifies that headers are to be displayed. –help Displays help information and then exits. –version Displays version information and then exits. -NUMBER Specifies the NUMBER of lines from the end of the file to begin with when printing. An example of the use of this utility is shown below. In this example the utility is used to display the last 50 bytes of the nameslist file. # tail -c 50 nameslist McCanta Joakim Erdfelt Pete Gizzi Neil Schroeder Joining multiple files The join utility actually searches both files for common entries. The entries found in both files are then displayed to stdoutwhere they can be redirected to a file. You can combine files using fields. The joinutility uses join fields to combine lines from multiple files. Before using the join utility, the files must be sorted on the join fields. This is often done by using the sortutility based on the fields that are to be joined. So, if you are utilizing two files that contain both first and last names and wish to join the files using last names, then the two files should first be sorted alphabetically using the last name field.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

176 Part II . Getting Around in (Web host 4 life) Linux

Thursday, July 26th, 2007

176 Part II . Getting Around in Linux Viewing the beginning of a file The head utility allows you to view the beginning of a file to aid with identification or other purposes. By default, the first ten lines of a file are displayed. It is important to remember that a line is everything before the line feed character, so the actual output could be much more than ten lines of display. Using options, it is possible to specify the number of lines displayed among other things. The options used with the headutility are covered in Table 4-8. Table 4-8 Options Used with head Option Use -n NUMBER Displays the first NUMBER of lines specified. -q Specifies that the header is not to be displayed. -v Specifies that the header is to be displayed. –help Displays help information and exits. –version Displays version information and exits. -c NUMBER Displays the first NUMBER of bytes specified. An example of the use of this file is shown below. In this example the first three lines of the nameslist file are displayed. The -v option is used to display the filename located in the header. # head -n 3 -v nameslist ==> nameslist <== Scott Bessler Jason Nash Angie Nash Viewing the end of a file There is also a utility that allows you to view the end of a file. Like head, the tail utility displays the last ten lines of a file by default. There are also several options used with the tailutility; these options, which are displayed in Table 4-9, allow more control of the data displayed.
Check Tomcat Web Hosting services for best quality webspace to host your web application.