当前位置:网站首页>[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 )
边栏推荐
- 精益六西格玛项目辅导咨询:集中辅导和点对点辅导两种方式
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
- Written on the first day after Doris graduated
- Introduction to MySQL audit plug-in
- It's settled! 2022 Hainan secondary cost engineer examination time is determined! The registration channel has been opened!
- Apk signature principle
- Tableapi & SQL and Kafka message insertion in Flink
- 摩根大通期货开户安全吗?摩根大通期货公司开户方法是什么?
- Solid smart contract development - easy to get started
- 张驰咨询:锂电池导入六西格玛咨询降低电池容量衰减
猜你喜欢

Intelligent operation and maintenance practice: banking business process and single transaction tracking

【一天学awk】条件与循环

【目标跟踪】|模板更新 时间上下文信息(UpdateNet)《Learning the Model Update for Siamese Trackers》

微信公众号订阅消息 wx-open-subscribe 的实现及闭坑指南
k8s部署redis哨兵的实现

opencv学习笔记五--文件扫描+OCR文字识别
![[leetcode] 16. The sum of the nearest three numbers](/img/60/6a68333d6e543c601e6ed586b830d0.png)
[leetcode] 16. The sum of the nearest three numbers

【STM32学习】 基于STM32 USB存储设备的w25qxx自动判断容量检测

张驰咨询:家电企业用六西格玛项目减少客户非合理退货案例

竣达技术丨多台精密空调微信云监控方案
随机推荐
采集数据工具推荐,以及采集数据列表详细图解流程
Flink 系例 之 TableAPI & SQL 与 Kafka 消息获取
A unifying review of deep and shallow anomaly detection
微信小程序02-轮播图实现与图片点击跳转
Qt+pcl Chapter 9 point cloud reconstruction Series 2
Tableapi & SQL and Kafka message acquisition of Flink example
opencv学习笔记五--文件扫描+OCR文字识别
STM32F4-TFT-SPI时序逻辑分析仪调试记录
《QT+PCL第六章》点云配准icp系列3
TypeScript:const
【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(三)
solidty-基础篇-基础语法和定义函数
S32K1xx 微控制器的硬件設計指南
【一天学awk】函数与自定义函数
S32K1xx 微控制器的硬件设计指南
张驰咨询:家电企业用六西格玛项目减少客户非合理退货案例
Filter &(登录拦截)
Written on the first day after Doris graduated
点云重建方法汇总一(PCL-CGAL)
【锁】Redis锁 处理并发 原子性

