LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-10-2012, 05:49 AM   #1
danieella
LQ Newbie
 
Registered: Dec 2012
Posts: 9

Rep: Reputation: Disabled
Display users with symbol 'w'


Hello everyone. Please i need your help to display users in a system that contain 'W' symbol in their name and store the information in a file. Thank you

'cat /etc/passwd' just display all users.
 
Old 12-10-2012, 06:16 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
This looks a bit like homework to me, so I'm going to provide a hint:

The grep command comes to mind. You do need to be careful and write a regular expression that only looks at the username field.
 
Old 12-10-2012, 06:26 AM   #3
danieella
LQ Newbie
 
Registered: Dec 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Home schooling

Quote:
Originally Posted by druuna View Post
This looks a bit like homework to me, so I'm going to provide a hint:

The grep command comes to mind. You do need to be careful and write a regular expression that only looks at the username field.
I am learning to use putty and answering questions randomly
I know cat /etc/passwd display all users. I need to know how to filter by displaying users with a particular character or symbol in their name. Thanks
 
Old 12-10-2012, 06:36 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Using grep:
Code:
grep "^.*a.*:x:" /etc/passwd
or, using awk (probably preferable):
Code:
awk -F: '$1 ~ "a" { print }' /etc/passwd
 
Old 12-10-2012, 06:44 AM   #5
danieella
LQ Newbie
 
Registered: Dec 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Reply

Quote:
Originally Posted by druuna View Post
Using grep:
Code:
grep "^.*a.*:x:" /etc/passwd
or, using awk (probably preferable):
Code:
awk -F: '$1 ~ "a" { print }' /etc/passwd
Using putty. The above command doesnt seem to work in putty
 
Old 12-10-2012, 07:03 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
I used an a instead of a w in my example.
 
1 members found this post helpful.
Old 12-10-2012, 07:07 AM   #7
danieella
LQ Newbie
 
Registered: Dec 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thank

Thanks drunna. I appreciate
 
Old 12-10-2012, 09:11 AM   #8
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Using putty. The above command doesnt seem to work in putty...
Putty is a terminal emulator, not command interpretter. Commands are specific to your OS or working shell, not to any tool like Putty. Same command will work in every tool if used in same OS and shell.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_file_link bagi Slackware 3 05-17-2011 07:49 AM
symbol lookup error: /usr/lib/libavcodec.so.51: undefined symbol: av_crc04C11DB7 priceey Linux - Software 0 05-06-2009 08:14 AM
./firefox-bin :symbol lookup error:/lib/libgthread-2.0.so.0: undefined symbol: arulupsaras Linux - General 1 11-08-2008 04:48 AM
symbol lookup error: /usr/lib/libgtk-x11.2.0.so.0: undefined symbol:... IamI Slackware 17 02-29-2008 11:10 AM
[FC2]Why does the users command display multiple users? Harkov Fedora 1 07-10-2004 09:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration