Glob and IO redirection detailed handouts

Source: Internet
Author: User

Globbing: File name wildcard

Match pattern: metacharacters

*: matches any character of any length

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/85/2A/wKiom1ebUFKBO7RGAAAhu4-dP7I770.png "title=" 1.png " alt= "Wkiom1ebufkbo7rgaaahu4-dp7i770.png"/>

? : Represents any single character

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/85/2A/wKioL1ebUN-CyLiQAAAJ_yPIaLM267.png "title=" 2.png " alt= "Wkiol1ebun-cyliqaaaj_ypialm267.png"/>

[]: matches any single character within the specified range

There are several special modes:

[A-z],[a-z],[0-9],[a-z0-9]

[[: Upper:]]: All uppercase letters

[[: Lower:]]: All lowercase letters

[[: Alpha:]]: All letters

[[: Alnum:]]: All letters and numbers

[[: Space:]]: all whitespace characters

[[:p ucnt:]]: All punctuation

[^]: matches any single character outside the specified range

[^[:upper:]]: match is not uppercase

[^0-9]: match is not a number

Example: Displays a directory or file with an any character that starts with L in the/var directory and ends with a lowercase letter.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/85/2B/wKioL1ebXbKhTsa9AAAUNG9mXxo529.png "title=" 5.png " alt= "Wkiol1ebxbkhtsa9aaaung9mxxo529.png"/>

Displays a question or table of contents that starts with any digit in the/testdir/directory and ends with a non-digit

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/85/2B/wKiom1ebXcOQ_T15AAAPUJxQHpQ489.png "title=" 6.png " alt= "Wkiom1ebxcoq_t15aaapujxqhpq489.png"/>

Displays a file or directory that starts with a non-letter, followed by a letter and any other character of any length, in the/etc directory

Ls-d/etc/[^[:alpha:]][[:alpaha:]]*


IO Redirection and piping

Program: Instruction + data

Program: IO

Devices available for input: keyboard

Devices available for output: Display

There are three types of data flow in the program:

Input data flow: <--standard input (stdin, keyboard)

Output data Flow:--> standard output (stdout, display, accurate is the user Terminal console),

Bad data flow:--> standard error Output (STDERR) is an interpreter-assisted data flow

Fd:file Descriptor, File descriptor

Standard input: 0

Standard output: 1

Error Output: 2 (Don't make a mistake, you're mistaken, it's 2.)


IO redirection:

Output REDIRECT:>

Features: Overlay output, 650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/85/2D/wKiom1ecDhSjmuR_AAAhhqmjR-U052.png "title = "1.png" alt= "Wkiom1ecdhsjmur_aaahhqmjr-u052.png"/>

Output REDIRECT:>>

Features: Append output,

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/85/2D/wKiom1ecEFaDsiTJAAAveEOwvxs595.png "title=" 1.png " alt= "Wkiom1ecefadsitjaaaveeowvxs595.png"/>

Note: The SET command can control overwrite redirection,

-c: Prohibit overwrite output redirect E when file exists

+c: Turn on overlay redirection

To force overwrite output redirection, use: >|

Error output stream redirection:2>,2>>

Merge normal output stream and error output stream:&> &>> (2>&1) Unix bloodline Orthodox Noble compatibility strong

(1) &>, &>>

(2) COMMAND >/path/to/somefile 2>&1

COMMAND >>/path/to/somefile 2>&1

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/85/2D/wKiom1ecE52AoQWRAAAZIZiZs2A024.png "title=" 1.png " alt= "Wkiom1ece52aoqwraaazizizs2a024.png"/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/85/2D/wKiom1ecFFbz3Mm6AABPl7Wa2ow951.png "title=" 1.png " alt= "Wkiom1ecffbz3mm6aabpl7wa2ow951.png"/>

Enter REDIRECT:<


TR command: Delete or replace

TR [OPTION] ... SET1 [SET2]

The pattern of the bitwise

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/85/2D/wKiom1ecF86x3l1cAAAZXfMRKqg761.png "title=" 1.png " alt= "Wkiom1ecf86x3l1caaazxfmrkqg761.png"/>

Here document:<< documentation

Cat < display on the screen

Cat </path/to/somefile/<<eof output to File

Pipeline: A connection program that implements the result of the previous command as the output of the latter command;

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/85/2E/wKioL1ecG0vxLbWpAAAPfreL1mw072.png "title=" 1.png " alt= "Wkiol1ecg0vxlbwpaaapfrel1mw072.png"/>


Glob and IO redirection detailed handouts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.