当前位置:网站首页>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边栏推荐
- Learn BeanShell before you dare to say you know JMeter
- Leetcode(540)——有序数组中的单一元素
- Hard core observation 547 large neural network may be beginning to become aware?
- DML Foundation
- [camera topic] how to save OTP data in user-defined nodes
- 【Camera专题】手把手撸一份驱动 到 点亮Camera
- Pytorch convolution network regularization dropblock
- y54.第三章 Kubernetes从入门到精通 -- ingress(二七)
- Qt之QComboBox添加QCheckBox(下拉列表框插入复选框,含源码+注释)
- 转载收录6.5大侠写的部分Qt开发经验
猜你喜欢

MySQL learning 03

Technology sharing | Frida's powerful ability to realize hook functions

Recommendation letter of "listing situation" -- courage is the most valuable

Stm32f407 ------- IIC communication protocol

stm32F407-------DMA

stm32F407-------IIC通讯协议
![[leetcode] 797 and 1189 (basis of graph theory)](/img/2a/9c0a904151a17c2d23dea9ad04dbfe.jpg)
[leetcode] 797 and 1189 (basis of graph theory)

Bottleneck period must see: how can testers who have worked for 3-5 years avoid detours and break through smoothly

返回一个树形结构数据

stm32F407-------ADC
随机推荐
What are the key points often asked in the redis interview
easyExcel
浏览器是如何对页面进行渲染的呢?
How to refresh the opening amount of Oracle ERP
Exception handling in kotlin process
【Camera专题】OTP数据如何保存在自定义节点中
In the face of difficult SQL requirements, HQL is not afraid
RestCloud ETL 跨库数据聚合运算
Swift开发学习
Basic operation of view
Socket programming
What are the differences between software testers with a monthly salary of 7K and 25K? Leaders look up to you when they master it
Anna: Beibei, can you draw?
Introduce in detail how to communicate with Huawei cloud IOT through mqtt protocol
4. 类和对象
[shutter] hero animation (hero realizes radial animation | hero component createrecttween setting)
Groovy, "try with resources" construction alternative
[Yu Yue education] Jiujiang University material analysis and testing technology reference
去除网页滚动条方法以及内外边距
疫情當頭,作為Leader如何進行團隊的管理?| 社區征文