Techniques for converting a string into a number in an awk
Source: Internet
Author: User
In awk Programming, do not forget that awk can process regular expressions. There are also a lot of internal functions, especially string processing functions. in the process of data processing, calling these functions can reduce the workload. 1. format // Note \ there cannot be spaces behind it, BEGIN... in awk Programming, do not forget that awk can process regular expressions. There are also a lot of internal functions, especially string processing functions. in the process of data processing, calling these functions can reduce the workload. 1. format // Note \ there cannot be spaces behind the END, and the "'" at the start position of BEGIN and the "'" at the END position cannot be forgotten. Awk-f' | '\' BEGIN {// begin part of awk} {// execution part of awk. to exit during processing, use exit (value ); it is equivalent to the END part of break} end {// awk in C language} '$ {old_filename} >>$ {new_filename} // old_filename is the file name to be processed. 2. variable reference in awk part, use the shell variable awk_value_name = "'$ {shell_value_name}'"; 3. in awk, convert a string to a number: in awk, convert a number string to a number: blockid = "1245"; when we need blockid to be a number, blockid = blockid + 0;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service