当前位置:网站首页>[one day learning awk] function and user-defined function
[one day learning awk] function and user-defined function
2022-07-01 15:24:00 【Programmer Xiao Li】
Built in functions
sin(expr) Sine
cos(expre) cosine
atan2(y,x) Anyway
exp(expr) Index
log(expr) logarithm
sqrt(expr) square root
int(expr) Integers
rand random number
srand([expr]) random number
Array sorting
awk 'BEGIN{a[0] = "c"; a[1] = "b"; a[2] = "a"; asort(a); for (ele in a){print a[ele]}}'
Sort by array index
awk 'BEGIN{a[0] = "c"; a[1] = "b"; a[2] = "a"; asorti(a); for (ele in a){print a[ele]}}'
String substitution gsub("pattern", "content", str)
Replace only once sub("pattern", "content", str)
String search index(str, "pattern")
If found, return to the location , Otherwise return to 0
String length length
Regular matching match(str, patten)
String segmentation split(str, array, "patten")
String to number
awk 'BEGIN{str = "123"; print strtonum(str)}'
String interception substr(str, index, len)
toggle case tolower(str) toupper(str)
Don't change the original string
Time stamp
awk 'BEGIN{print SYSTIME() }'
Print time
awk 'BEGIN {
print strftime("Time=%m/%d/%Y %H:%M:%S", SYSTIME())
}'
Get a row
Custom function
Output redirection ( Additional )
Output redirection ( Cover )
边栏推荐
- 摩根大通期货开户安全吗?摩根大通期货公司开户方法是什么?
- Task. Run(), Task. Factory. Analysis of behavior inconsistency between startnew() and new task()
- opencv学习笔记五--文件扫描+OCR文字识别
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
- The solution to turn the newly created XML file into a common file in idea
- STM32F411 SPI2输出错误,PB15无脉冲调试记录【最后发现PB15与PB14短路】
- 《QT+PCL第六章》点云配准icp系列2
- MySQL 服务正在启动 MySQL 服务无法启动解决途径
- swiper 轮播图,最后一张图与第一张图无缝衔接
- OpenSSL client programming: SSL session failure caused by an insignificant function
猜你喜欢
Opencv learning notes 5 -- document scanning +ocr character recognition
Recommendation of data acquisition tools and detailed graphic process of data acquisition list
重回榜首的大众,ID依然乏力
The solution to turn the newly created XML file into a common file in idea
MySQL service is starting. MySQL service cannot be started. Solution
Raytheon technology rushes to the Beijing stock exchange and plans to raise 540million yuan
The markdown editor uses basic syntax
MySQL 服务正在启动 MySQL 服务无法启动解决途径
【目标跟踪】|STARK
Skywalking 6.4 distributed link tracking usage notes
随机推荐
The last picture is seamlessly connected with the first picture in the swiper rotation picture
solidty-基础篇-基础语法和定义函数
Survey of intrusion detection systems:techniques, datasets and challenges
Hidden rules of the workplace that must be understood before 30
微信小程序02-轮播图实现与图片点击跳转
Go zero actual combat demo (I)
idea中新建的XML文件变成普通文件的解决方法.
IDEA全局搜索快捷键(ctrl+shift+F)失效修复
opencv学习笔记六--图像拼接
Qt+pcl Chapter 6 point cloud registration ICP series 3
Tableapi & SQL and MySQL data query of Flink
选择在长城证券上炒股开户可以吗?安全吗?
[leetcode] 16. The sum of the nearest three numbers
Digital transformation: data visualization enables sales management
《QT+PCL第九章》点云重建系列2
Tableapi & SQL and MySQL insert data of Flink
Solid basic structure and array, private / public function, return value and modifier of function, event
Tiantou village, Guankou Town, Xiamen special agricultural products Tiantou Village special agricultural products ant new village 7.1 answer
Apk signature principle
Junda technology - wechat cloud monitoring scheme for multiple precision air conditioners