In awk programming, do not forget that awk processes regular expressions. There are many internal functions, especially string processing functions. Calling these functions can reduce the workload.
1. Format
// Note \ There cannot be spaces behind the end, and the start position "'" and end position "'" cannot be forgotten.
Awk-F '&'\
'In in {
// Awk begin part
}
{
// The execution part of the awk. To exit during the processing, use exit (value); equivalent to break in for in C Language
}
End
{
// Awk end part
} '$ {Old_filename} >$ {new_filename} // old_filename is the file name to be processed
2. variable reference
In the awk section, use the shell variable awk_value_name = "'$ {shell_value_name }'";
For example:
// Where blockid is the awk variable, and blockid is the shell variable. 3. How to convert a string number to a number in awk: blockid = "1245"; When blockid is required to be a number, blockid = blockid + 0; 4. The string in awk is equal. Use = to judge.