当前位置:网站首页>Awk from entry to burial (1) awk first meeting
Awk from entry to burial (1) awk first meeting
2022-07-03 02:14:00 【Wonderful binary】
Let's give you one first awk A simple example of , Let's get to know awk The basic structure of the command .
1、 First experience
Let's create a name marks.txt The file of . Including serial number 、 Student name 、 Course name and grades .
1) Amit Physics 80
2) Rahul Maths 90
3) Shyam Biology 87
4) Kedar English 85
5) Hari History 89
Next , We will use AWK Script to display the contents of the output file , At the same time, output header information .
[jerry]$ awk 'BEGIN{printf "Sr No\tName\tSub\tMarks\n"} {print} END{printf "----------------------------\n"}' marks.txt
After executing the above code , The following results will be output :
Sr No Name Sub Marks
1) Amit Physics 80
2) Rahul Maths 90
3) Shyam Biology 87
4) Kedar English 85
5) Hari History 89
----------------------------
Output multiple headers and split lines , Besides, it looks no different from the content of the source file . But this statement describes awk The basic structure of grammar , Let's introduce .
awk 'BEGIN{printf "Sr No\tName\tSub\tMarks\n"} {print} END{printf "---------------
边栏推荐
- Cfdiv2 fixed point guessing- (interval answer two points)
- Y54. Chapter III kubernetes from introduction to mastery -- ingress (27)
- Wechat applet Development Tool Post net:: Err Proxy Connexion Problèmes d'agent défectueux
- Detailed introduction to the usage of Nacos configuration center
- [Flutter] dart: class;abstract class;factory;类、抽象类、工厂构造函数
- Su Shimin: 25 principles of work and life
- File class (add / delete)
- Return the only different value (de duplication)
- 【Camera专题】手把手撸一份驱动 到 点亮Camera
- [leetcode] 797 and 1189 (basis of graph theory)
猜你喜欢
Wechat applet Development Tool Post net:: Err Proxy Connexion Problèmes d'agent défectueux
Visual yolov5 format data set (labelme JSON file)
What are the differences between software testers with a monthly salary of 7K and 25K? Leaders look up to you when they master it
可视化yolov5格式数据集(labelme json文件)
[leetcode] 797 and 1189 (basis of graph theory)
What are MySQL locks and classifications
Return a tree structure data
Flink CDC mongoDB 使用及Flink sql解析monggo中复杂嵌套JSON数据实现
Button button adaptive size of wechat applet
Comment communiquer avec Huawei Cloud IOT via le Protocole mqtt
随机推荐
Modify table structure
疫情當頭,作為Leader如何進行團隊的管理?| 社區征文
力扣(LeetCode)183. 从不订购的客户(2022.07.02)
树形结构数据的处理
Swift development learning
DQL basic operation
Hard core observation 547 large neural network may be beginning to become aware?
4. 类和对象
CFdiv2-Fixed Point Guessing-(區間答案二分)
【Camera专题】HAL层-addChannel和startChannel简析
[leetcode] 797 and 1189 (basis of graph theory)
Job object of collaboration in kotlin
require.context
Use go language to realize try{}catch{}finally
Learn BeanShell before you dare to say you know JMeter
【Camera专题】手把手撸一份驱动 到 点亮Camera
Detailed introduction to the deployment and usage of the Nacos registry
How to deal with cache hot key in redis
elastic stack
LabVIEW安装第三方VISA软件后NI VISA失效