As a system administrator, you have received a file named 'logins.txt' containing a list of usernames. However, the usernames are separated by commas and you need them to be separated by newlines to process them in a script. Using the 'tr' command, how would you translate the commas into newline characters in a shell script?
The command 'tr ',' '\n' < logins.txt' is used for replacing all commas in the file 'logins.txt' with newline characters. This is the correct use of the 'tr' command where the first argument is the set of characters to be replaced (commas) and the second argument is the set of characters to replace with (newline characters). The '<' operator is used to pass the contents of 'logins.txt' to the 'tr' command.
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 does the 'tr' command do?
Open an interactive chat with Bash
What does the '<' operator do in the command?
Open an interactive chat with Bash
Why would newline characters be used instead of commas for usernames?