Here is the problem I was faced with. I wanted to check if I was part of a particular group and I did the shell groups command to find out.
Unbeknownst to me I was part of a tone of groups that included some complicated long names with backslashes (\) in them.
I thought it would be quick to grep for the particular group name if all the output was on separate lines instead of space separated on one line.
First I thought I can use cut command to do that but it turns out cut is not idea for this. It is more suitable if you have multiple lines of data and wanted to get the same column out of each of these. Something like output from ps.
Finally I achieved it really easily with with tr command. Here is how the solution looks like:
groups | tr ' ' '\n' | grep group_i_was_looking_for