Skip to content

Commit d086613

Browse files
committed
join example
1 parent c5379a2 commit d086613

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

files/passwd

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
jd001:x:1032:666:Javier Diaz::/bin/rbash
2-
ag002:x:8050:668:Alejandro Gonzalez::/bin/rbash
3-
jp003:x:1000:666:Jose Perez::/bin/bash
4-
ms004:x:8051:668:Maria Saenz::/bin/rbash
5-
rc005:x:6550:668:Rosa Camacho::/bin/rbash
1+
jd001:x:1032:001:Javier Diaz::/bin/rbash
2+
ag002:x:8050:002:Alejandro Gonzalez::/bin/rbash
3+
jp003:x:1000:001:Jose Perez::/bin/bash
4+
ms004:x:8051:002:Maria Saenz::/bin/rbash
5+
rc005:x:6550:002:Rosa Camacho::/bin/rbash

join_users_groups.awk

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Passwd and Group
2+
# Example: awk -f join_users_groups.awk files/group files/passwd
3+
#
4+
#
5+
6+
7+
BEGIN{
8+
FS=":"
9+
}
10+
NR == FNR{g[$3]=$1;next}
11+
$4 in g{print $1""FS""g[$4]}

0 commit comments

Comments
 (0)