Tuesday, July 21, 2015

Displaying contents from multiple row to single row with a space.

Displaying contents from multiple row to single row with a space.

$ cat /etc/passwd | awk -F: '{print $1}' | more
root
daemon
bin
sys
adm
lp
uucp
smmsp
listen

$ cat /etc/passwd | awk -F: '{print $1}' | tr "\n" " "
root daemon bin sys adm lp uucp smmsp listen

No comments:

Post a Comment