Linux Learning Note--shell Programming (ix)

Source: Internet
Author: User

+++++++++++++++++++++++++ +++++shell Programming +++++++++++++++++++++++++++++++ 1. Basic Regular Expressionsregular expressions and wildcard characters:regular expressions are used to match conditional strings in a file, Regex contains matches, grep awk, and other commands can support regular expressions; Wildcards are used to match qualified file names, wildcards are exact matches, LS find CP these commands do not support regular expressions, so you can only Match with the Shell's own wildcard characters. Basic Regular expression:     2. Character Intercept commandsField Extraction command: Cut [options] file nameoption:-F (Extract columns)-D (split column by specified delimiter)Note: Limitations of the Cut command formatted output command: printf ' output type output format ' output contentOutput Type:               output Format:               Note: The print and printf commands are supported in the output of the awk command, except that print automatically adds a newline character.      intercept the specified column: awk ' condition 1{action 1} Condition 2{action 2} Condition 3{action 3} ... ' File name (same as Cut command function, but more powerful than cut function)conditions--general use of relational expressions as criteriaactions--formatted output or Process Control statements Stream Editor: sed [options] ' [action] ' file nameoption:-N (outputs the corresponding line)-e (allows multiple SED action edits to be applied to input data)-I (the file that reads the data directly with the result of the SED modification, not the screen output)Action:               Note: SED is a lightweight flow editor that is almost included on all UNIX platforms. The SED command is primarily used to select, replace, delete, and add commands to the data. 3. Character processing CommandsSort command: Sort [Options] file nameOptions:               statistics command: WC [option] File nameOptions:-L (count rows only)-W (count only words)-m (count characters only)
4. Conditional JudgmentJudging by file type          to judge by file permissions          compare between two files          A comparison between two integers          the judgment of a string          Multiple Conditional Judgments                5. Process ControlIf statementSingle Branch if statementDual-Branch if condition statementMulti-branch if condition statementMulti-branch case condition statementFor LoopWhile loops and until loops+++++++++++++++++++++++++ +++++shell Programming +++++++++++++++++++++++++++++++           

Linux Learning Note--shell Programming (ix)

Related Article

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.