here are some slides for introduction to C++. this slide is merely for basic understanding for C++. this powerpoint is written in Traditional Chinese(TW) and is owned by a group named "Awakening Lion" which I participate in.
here are some slides for introduction to C++. this slide is merely for basic understanding for C++. this powerpoint is written in Traditional Chinese(TW) and is owned by a group named "Awakening Lion" which I participate in.
Since the previous LTS, JDK 17, was released in 2021, there are quite lots of features added into the Java specification. In this year, the latest JDK 21 LTS version is released and brings us many formal functions to improve our daily works. This session will focus on the new features, including String Templates, Sequenced Collections, Record Patterns, Pattern Matching for switch, Unnamed features and Virtual Threads.
7. 输出
- print函数
• 转义字符
print函数支持如下常用的转义字符:
t 制表符 n 换行
r 回车 b 退格
f 换页
示例:
awk '/^John/{print "ttHave a nice day, " $1, $2 "!"}' emp
输出如下:
Have a nice day, John Mayer!
19. 内置变量
NR & FNR
• 引用awk文档的解释:
NR ordinal number of the current record
FNR ordinal number of the current record in the current file
NR指的是当前的记录号, 不管出自哪个文件一直递增;
FNR指的是在当前文件中的记录号, 每读取一个新的文件
FNR重置为1. 示例:
echo "1 abc" > file1
echo "2 def" > file2
awk 'BEGIN{print "NRtFNRtContent"}{printf "%dt%dt%sn", NR,
FNR, $0}' file1 file2
输出如下:
NR FNR Content
1 1 1 abc
2 1 2 def