高效awk编程第3版 $3 读入文件
时间:2006-12-12 来源:oychw
• How Input Is Split into Records
• Examining Fields
• Non-constant Field Numbers
• Changing the Contents of a Field
• Specifying How Fields Are Separated
• Reading Fixed-Width Data
• Multiple-Line Records
• Explicit Input with getline
默认以换行为分隔记录的符号,是可以改变的,以下改为用/分隔.
[root@Meil89 awk]# awk 'BEGIN { RS = "/" }
> { print $0 }' BBS-list
aardvark 555-5553 1200
300 B
alpo-net 555-3412 2400
1200
300 A
通过命令行也可以改记录分隔符:
[root@Meil89 awk]# awk '{ print $0 }' RS="/" BBS-list
aardvark 555-5553 1200
300 B
alpo-net 555-3412 2400
• Examining Fields
• Non-constant Field Numbers
• Changing the Contents of a Field
• Specifying How Fields Are Separated
• Reading Fixed-Width Data
• Multiple-Line Records
• Explicit Input with getline
默认以换行为分隔记录的符号,是可以改变的,以下改为用/分隔.
[root@Meil89 awk]# awk 'BEGIN { RS = "/" }
> { print $0 }' BBS-list
aardvark 555-5553 1200
300 B
alpo-net 555-3412 2400
1200
300 A
通过命令行也可以改记录分隔符:
[root@Meil89 awk]# awk '{ print $0 }' RS="/" BBS-list
aardvark 555-5553 1200
300 B
alpo-net 555-3412 2400
相关阅读 更多 +