Issue
Currently when I run a grep command on a visitors group that I had created
grep visitors:x:1011: /etc/group
This is a sample result of the above command, as the actual result is too long.
visitors:x:1011:ellipsiscoterie,magnetcommonest,wizardmeans,beakskeletal,lemonwellmade,ralphpaperclips etc..
How do I display the above result as shown below (without visitors:x:1101 and separating the commas), as I have difficulty doing so.
ellipsiscoterie
magnetcommonest
wizardmeans
beakskeletal
lemonwellmade
ralphpaperclips
Solution
I suggest using sed
instead of grep
sed -n -e 's/^visitors\:x\:1011\://p' /etc/group | tr ',' '\n'
UPD: detailed explain of sed
part is here. tr
examples you can find here
Answered By - Pavel Sapezhka Answer Checked By - Senaida (WPSolving Volunteer)