Linux: File Command Proficient Guide-3-

xiaoxiao2021-03-06  42

The commands that view and find file file filters are used to read file content and execute operations on file contents are sometimes referred to as 1Y filters. The SED and AWK commands are examples of two filters because they have their detailed discussions in the previous OTN articles, which will be slightly here. Commands such as Cat, More, and Less allow you to view the contents of a text file from the command line without calling the editor. CAT is an abbreviation of 'Concatenate', which will display file content by default on the standard output (display). One of the most interesting options provided with CAT is the -n option, which displays the file content with the number output line. $ Cat -n test.out 1 this is a test. Because of all lines in the Cat in a single output file, you may prefer to use more and less because they output a screen content. Less is an enhanced version of more that allows you to enhance files with a key command from the VI text editor. For example, D forward is rolled forward, and B is turned backwards (if N is specified before D or B). The value of N-input becomes the default value of the subsequent D command. The MAN page utility uses LESS to display the contents of the instructions. Redirection and Pipe Redirection Allows the command output to redirect to the file, rather than standard output, or similarly, or redirect input. Returned Standard Symbol> Create a new file. >> Symbols Add to an existing file: $ more test2.out noother test. $ Cat test.out >> Test2.out $ cat test2.out another test. This is a test. To file standard input You can redirect and add: $ CAT and 2 >> to redirect and add, the format is as follows: $ comMand 2> name_of_error_file To avoid unintentionally overwriting an existing file, use Bash Built-in commands: $ set -o noclobber can overload this feature with>! Symbols between commands and output files. To turn off this feature, use O instead of -O. Redirect between a command and files, or between files and files. One of the redirected statements must be a file. Pipeline uses | symbols, and work between commands. For example, you can send a command directly to the printer in the following way: $ ls -l * | LPR can quickly find one of the historical lists in the following way: $ history | grep cat More filter GREP Both FGREP and EGREP display a row that matches a mode. All three commands are searching for specified patterns in the file, which will be very useful if you can't think of a name of the file. The basic format is: grep [options] pattern [file ...] $ grep -r 'Subject' NSMAIL Ctrl-z will terminate the above or any other command. The most useful option of GREP may be -s. If you search the system file with any identity other than rooted users, an error message will be generated for each file you have no access. This command prohibits those messages. FGREP (also in grep -f call) only looks for a fixed string instead of GREP's regular expression. The EGREP receives a mode containing a larger range of special characters (such as "|", it indicates the condition OR operator).

转载请注明原文地址:https://www.9cbs.com/read-60952.html

New Post(0)