• 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
阅读(3158) | 评论(0) | 转发(0) |