shell script - programming prelude - cut of gadgets

Goal :
to understand the shell wildcard
familiar gadgets and cut the shell using wildcards

 

What is the cut

cut column is taken tool for intercepting the column.

(1) grammar

# Cut options file name

(2) Common Options

-c divided in units of characters, taken
-d custom delimiter, default tab \ t
used in conjunction with -d -f, specifies which region taken

For example

cut-d: -f1 1.txt to: colon split, truncated column first content

cut -d: -f1,6,7 1.txt       to: colon segmentation, 1,6,7 column content of interception

cut -c4 1.txt       taken per line in the first 4 characters  

cut -c1-4 1.txt     taken documents 1-4 characters per line 

cut -c4-10 1.txt    intercept file 4-10 characters per line

cut -c5-1.txt     from all five characters after the character begins intercepting

 

Combat :

1. Specific Requirements: Interception ":" The first character segmentation

2. Specific requirements: intercepting ":" Split 1 to 7

3. Specific Requirements: intercepting characters 1-5

4. Specific requirements: taken after 10 characters

5. specific needs: intercepting 5-10 characters

6. Specific requirements: cut interception spaces

cut -d' ' -f1

7. Specific requirements: Lists the current system run level

Guess you like

Origin www.cnblogs.com/-lyr/p/12152709.html