December 5th, 2011, 05:45 AM
I have a shell which shud display the name of the user so i use below grep to take their name
grep 'l828117' /etc/passwd
l828117:0************:828117:357:Thelak Kumar ANBALAGAN, Etudes ACE-TP,,:/home/l828117:/usr/bin/ksh
then i decided to display only the name so i used the below code
but it displaying like below
grep 'l828117' /etc/passwd|cut -d ' ' -f1,2,3
l828117:0************:828117:357:Thelak Kumar ANBALAGAN,
i have to achieve only with name like Thelak Kumar ANBALAGAN
how to do this.
December 5th, 2011, 11:32 AM
grep 'l828117' /etc/passwd|cut -d ':' -f5
December 5th, 2011, 11:45 AM
Might also, using similar method, wish to 'parse out' the comment text from the comma onwards.
grep 'l828117' /etc/passwd|cut -d ':' -f5 | cut -d ',' -f1
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc
December 7th, 2011, 09:37 AM