当前位置:网站首页>[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 )
边栏推荐
- Wechat applet 03 - text is displayed from left to right, and the block elements in the line are centered
- 【一天学awk】函数与自定义函数
- 采集数据工具推荐,以及采集数据列表详细图解流程
- Written on the first day after Doris graduated
- Hidden rules of the workplace that must be understood before 30
- 摩根大通期货开户安全吗?摩根大通期货公司开户方法是什么?
- Survey of intrusion detection systems:techniques, datasets and challenges
- 项目中字符串判空总结
- Survey of intrusion detection systems:techniques, datasets and challenges
- Demand prioritization method based on value quantification
猜你喜欢

The data in the database table recursively forms a closed-loop data. How can we get these data

【目标跟踪】|STARK

MySQL审计插件介绍

"Qt+pcl Chapter 6" point cloud registration ICP Series 6

入侵检测模型(An Intrusion-Detection Model)

Wechat applet 01 bottom navigation bar settings

《性能之巅第2版》阅读笔记(五)--file-system监测
![[leetcode] 16. The sum of the nearest three numbers](/img/60/6a68333d6e543c601e6ed586b830d0.png)
[leetcode] 16. The sum of the nearest three numbers

Raytheon technology rushes to the Beijing stock exchange and plans to raise 540million yuan

MySQL service is starting. MySQL service cannot be started. Solution
随机推荐
Go zero actual combat demo (I)
The data in the database table recursively forms a closed-loop data. How can we get these data
采集数据工具推荐,以及采集数据列表详细图解流程
张驰咨询:家电企业用六西格玛项目减少客户非合理退货案例
Solid smart contract development - easy to get started
SAP s/4hana: one code line, many choices
The solution to turn the newly created XML file into a common file in idea
Tableapi & SQL and MySQL insert data of Flink
Flink 系例 之 TableAPI & SQL 与 Kafka 消息插入
微信公众号订阅消息 wx-open-subscribe 的实现及闭坑指南
OpenSSL client programming: SSL session failure caused by an insignificant function
Junda technology indoor air environment monitoring terminal PM2.5, temperature and humidity TVOC and other multi parameter monitoring
Solidty智能合约开发-简易入门
Guide de conception matérielle du microcontrôleur s32k1xx
Official announcement: Apache Doris graduated successfully and became the top project of ASF!
竣达技术丨室内空气环境监测终端 pm2.5、温湿度TVOC等多参数监测
JS中箭头函数和普通函数的区别
Can I choose to open an account on Great Wall Securities? Is it safe?
【目标跟踪】|模板更新 时间上下文信息(UpdateNet)《Learning the Model Update for Siamese Trackers》
微服务追踪SQL(支持Isto管控下的gorm查询追踪)

