Mainly shell several common operations: 1 shell and awk combined with 2 shell string operations 3 shell file operations and awk combined 4 file MD5 verification 5 results output 6 passing parameters, etc.
The following content cannot be completely correct, but is not a copy of the original text.
$ Sh test. Sh tablename 20090310
Use the preceding statements to call shell. tablename and 20090310 are two parameters.
It is also assumed that there is a log file *. log. Generally, the use of awk also analyzes many logs.
Assume that log. log has the following text: systemname '2017-02-28 10:00:00 '123 '...
SH Content:
# Note
Servername = 192.168.10.1
Tablename = $1
Filedate = $2
Interfacefilename = log. Log
CD./log
Logfilename = log _ $ tablename. Log
Echo $ logfilename
Interfacename = int
Interfacename =$ {interfacename }_$ {tablename: 1}
Interfacename =$ {interfacename }_$ {filedate} _. Log
Echo interfacename
Filesize = $ (LS-L $ logfilename | awk '{print $5 }')
Filedate = $ (cat $ logfilename | gawk-F/''{print $2 }')
Filemd5 =$ (md5sum $ logfilename | awk '{print $1 }')
# Output file
Echo "$ servername | interfacename | filesize |..." >$ {interfacefilename}