A system administrator needs to extract the username and home directory for accounts using the Bash shell from a colon-separated file named users.txt, where the seventh field defines the login shell and the sixth field holds the home path. Which command achieves this?
The correct command sets the field separator to a colon with -F:, filters records where the seventh field matches /bin/bash, and prints the first and sixth fields. Incorrect options use wrong field numbers, improper quoting, or other tools that don’t handle the conditions accurately.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the 'awk' command?
Open an interactive chat with Bash
What do the options '-F:' and 'FS=":"' mean in the awk command?
Open an interactive chat with Bash
How does field filtering work in the command 'awk -F: '$7 == "/bin/bash" { print $1, $6 }' users.txt'?