Get seven Method 1 of string length. \${#str}
Length of 2.awk
Note:
1) It is best to use {} to place the variable
2) You can also use length ($) to count the lengths of each line in the file
3.awk NF
Note:-F is a delimiter, NF is the number of fields, that is, the length of a single string
4.WC-L
Note:-l parameter
1) for multi-line files, the length of the longest line is printed! 82, which indicates the length of the longest line of the/etc/passwd file is 82
2) for a single-line string, the length of the current line string!
5.wc-c
Note:
1)-C parameter: number of statistics characters
2)-N parameter: remove "\ n" line break, if not removed, by default with line break, the number of characters is 7
Length of 6.expr
7.expr $str: ". *" Tips
Note:. * represents any character, that is, to match a string with any characters, the result is matched to 6, that is, the length of the string is 6
From
http://blog.csdn.net/jerry_1126/article/details/51835119
Linux shell Script programming Note (iv): Seven ways to get the length of a string