--- awk shell command of

1.awk program:

  1.1 Use variable data fields:

    gawk One of the main characteristics is its ability to process text files of data. A variable that is automatically assigned to each data element in a row. By default, the gawk will be assigned to the variable as its data fields found in the line of text:    

      $ 0 represents the entire line of text;

      $ 1 representative of the first text line in a data field;

      $ 2 representative of the first text line 2 data fields;

      $ n representative of the first text line n data fields.

    In the text line, by each data field is a field separator partition. gawk when reading a line of text, it will use a predetermined delimiter into predefined fields within each data field. gawk default field delimiter is any whitespace characters (e.g. spaces or manufactured tab character)

  1.2 before running the script processing the data

    BEGIN command

    ex:# gawk -F : 'BEGIN{print "passwd user:"} {print $1}' /etc/passwd

  1.3 Run the script after processing the data

    END command

 

  

  

 

Guess you like

Origin www.cnblogs.com/weidongliu/p/11001882.html