Vps web hosting - Chapter 2 . Running Commands from the Shell

Chapter 2 . Running Commands from the Shell 75 . /The.*foot Searches forward for a line that has the word The in it and also, after that at some point, the word foot. . ?[pP]rint Searches backward for either print or Print. Remember that case matters in Linux, so make use of brackets to search for words that could have different capitalization. The vi editor was originally based on the ex editor, which didn t let you work in fullscreen mode. However, it did enable you to run commands that let you find and change text on one or more lines at a time. When you type a colon and the cursor goes to the bottom of the screen, you are essentially in ex mode. Here is an example of some of those ex commands for searching for and changing text. (I chose the words Local and Remote to search for, but you can use any appropriate words.) . :g/Local Searches for the word Local and prints every occurrence of that line from the file. (If there is more than a screenful, the output is piped to the more command.) . :s/Local/Remote Substitutes Remote for the word Local on the current line. . :g/Local/s//Remote Substitutes the first occurrence of the word Local on every line of the file with the word Remote. . :g/Local/s//Remote/g Substitutes every occurrence of the word Local with the word Remote in the entire file. . :g/Local/s//Remote/gp Substitutes every occurrence of the word Local with the word Remote in the entire file, and then prints each line so that you can see the changes (piping it through more if output fills more than one page). Using Numbers with Commands You can precede most vi commands with numbers to have the command repeated that number of times. This is a handy way to deal with several lines, words, or characters at a time. Here are some examples: . 3dw Deletes the next three words. . 5cl Changes the next five letters (that is, removes the letters and enters input mode). . 12j Moves down 12 lines. Putting a number in front of most commands just repeats those commands. At this point, you should be fairly proficient at using the vi command. When you invoke vi in many Linux systems, you re actually invoking the vim text editor, which runs in vi compatibility mode. Those who do a lot of programming might prefer vim because it shows different levels of code in different colors. vim has other useful features, such as the capability to open a document with the cursor at the same place as it was when you last exited that file. Note
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply