当前位置:网站首页>[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 )
边栏推荐
- 【目标跟踪】|STARK
- S32K1xx 微控制器的硬件设计指南
- Using swiper to make mobile phone rotation map
- Summary of week 22-06-26
- Junda technology - wechat cloud monitoring scheme for multiple precision air conditioners
- Short Wei Lai grizzly, to "touch China" in the concept of stocks for a living?
- opencv学习笔记六--图像拼接
- How to realize clock signal frequency division?
- 【云动向】6月上云新风向!云商店热榜揭晓
- Opencv Learning Notes 6 -- image mosaic
猜你喜欢

Filter & (login interception)
![[leetcode] 16. The sum of the nearest three numbers](/img/60/6a68333d6e543c601e6ed586b830d0.png)
[leetcode] 16. The sum of the nearest three numbers
Implementation of deploying redis sentry in k8s

The markdown editor uses basic syntax

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

opencv学习笔记五--文件扫描+OCR文字识别

Qt+pcl Chapter 9 point cloud reconstruction Series 2

A unifying review of deep and shallow anomaly detection

Fix the failure of idea global search shortcut (ctrl+shift+f)

异常检测中的浅层模型与深度学习模型综述(A Unifying Review of Deep and Shallow Anomaly Detection)
随机推荐
TypeScript:var
solidty-基础篇-基础语法和定义函数
《QT+PCL第六章》点云配准icp系列3
Qt+pcl Chapter 6 point cloud registration ICP Series 2
Basic use process of cmake
关于用 ABAP 代码手动触发 SAP CRM organization Model 自动决定的研究
skywalking 6.4 分布式链路跟踪 使用笔记
Solid smart contract development - easy to get started
Qt+pcl Chapter 9 point cloud reconstruction Series 2
What is the relationship between network speed, broadband, bandwidth and traffic?
张驰课堂:六西格玛数据的几种类型与区别
异常检测中的浅层模型与深度学习模型综述(A Unifying Review of Deep and Shallow Anomaly Detection)
The difference between arrow function and ordinary function in JS
微服务追踪SQL(支持Isto管控下的gorm查询追踪)
Apk signature principle
opencv学习笔记四--银行卡号识别
Guide de conception matérielle du microcontrôleur s32k1xx
How to realize clock signal frequency division?
【云动向】6月上云新风向!云商店热榜揭晓
go-zero实战demo(一)

