当前位置:网站首页>Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
Awk from getting started to getting into the ground (3) the built-in functions printf and print of awk realize formatted printing
2022-07-03 02:14:00 【Wonderful binary】
awk in print And printf The main differences are shown in the following two points :
- print When displaying multiple results, separate them with commas , As a result, the contents of these parts will automatically use the output separator ( The default field output delimiter is a space , The record output delimiter defaults to line feed ) separation , And there is no need to add line breaks \n; If not used , interval , Will be connected when printing , Even if spaces are used :
[email protected]:~$ awk -F: 'BEGIN{k=1} {print $1,$2}' /etc/passwd
root x
daemon x
bin x
sys x
[email protected]:~$ awk -F: 'BEGIN{k=1} {print $1 $2}' /etc/passwd
rootx
daemonx
binx
sysx
syncx
gamesx
- printf You can control the output format of a field more flexibly , By using %-12s,%3.1f Equal formatting method .printf Closer to using C The habits of language students .
$ awk -F: 'BEGIN{k=1} {printf "%s,%s
边栏推荐
- leetcode961. Find the elements repeated N times in the array with length 2n
- Asian Games countdown! AI target detection helps host the Asian Games!
- Swift development learning
- iptables 4层转发
- Hard core observation 547 large neural network may be beginning to become aware?
- Wechat applet development tool post net:: err_ PROXY_ CONNECTION_ Failed agent problem
- SPI机制
- Introduce in detail how to communicate with Huawei cloud IOT through mqtt protocol
- 我的创作纪念日
- y54.第三章 Kubernetes从入门到精通 -- ingress(二七)
猜你喜欢
创建+注册 子应用_定义路由,全局路由与子路由
easyPOI
Y54. Chapter III kubernetes from introduction to mastery -- ingress (27)
In the face of difficult SQL requirements, HQL is not afraid
Deep learning notes (constantly updating...)
MySQL学习03
His experience in choosing a startup company or a big Internet company may give you some inspiration
深度(穿透)选择器 ::v-deep/deep/及 > > >
stm32F407-------DMA
The testing process that software testers should know
随机推荐
Analyzing several common string library functions in C language
力扣(LeetCode)183. 从不订购的客户(2022.07.02)
Button button adaptive size of wechat applet
创建+注册 子应用_定义路由,全局路由与子路由
502 (bad gateway) causes and Solutions
微信小程序开发工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理问题
File class (add / delete)
通达OA v12流程中心
CFdiv2-Fixed Point Guessing-(區間答案二分)
Groovy, "try with resources" construction alternative
Hard core observation 547 large neural network may be beginning to become aware?
Kotlin middle process understanding and Practice (I)
Leetcode (540) -- a single element in an ordered array
5.文件操作
Comment le chef de file gère - t - il l'équipe en cas d'épidémie? Contributions communautaires
stm32F407-------ADC
2022 spring "golden three silver four" job hopping prerequisites: Software Test interview questions (with answers)
Analysis, use and extension of open source API gateway apisex
Cfdiv2 Fixed Point Guessing - (2 points for Interval answer)
机器学习流程与方法