Linux Search Pattern Question:
Download Job Interview Questions and Answers PDF
One of the entry of /etc/passwd file is shown below:
user1:x:1111:2222:google:/home/user1:/bin/bash
Which among the following will print userid and home dir in the following pattern "user1:/home/user1"?
a) awk `{print $1 ":" $6}` /etc/passwd
b) awk `{print $1 ":" $7}` /etc/passwd
c) awk `{print $2 ":" $6}` /etc/passwd
d) awk `{print $2 ":" $7}` /etc/passwd
Answer:
a) awk `{print $1 ":" $6}` /etc/passwd
Download Search Pattern Interview Questions And Answers
PDF