1
2
3
4
5
6
7
8
9
|
[root@yonglinux ~]
# head -n2 passwd |awk -F: '{print $1}'
root
bin
[root@yonglinux ~]
# head -n2 passwd |awk -F: '{print $0}'
root:x:0:0:root:
/root
:
/bin/bash
bin:x:1:1:bin:
/bin
:
/sbin/nologin
[root@yonglinux ~]
# head -n2 passwd |awk -F: '{print $1,$3,$7}'
root 0
/bin/bash
bin 1
/sbin/nologin
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[root@localhost ~]
# awk -F: '{print $3,$4}' 1.txt |head -5
0 0
1 1
2 2
3 4
4 7
[root@localhost ~]
# awk -F: '{print $3":"$4}' 1.txt |head -5
0:0
1:1
2:2
3:4
4:7
[root@localhost ~]
# awk -F: 'OFS="#"{print $3,$4}' 1.txt |head -5
0
#0
1
#1
2
#2
3
#4
4
#7
|
1
2
3
|
[root@yonglinux ~]
# head -n2 passwd |awk -F: '{print $1"#""@"$3"#"$7}'
root
#@0#/bin/bash
bin
#@1#/sbin/nologin
|