LinuxQuestions.org
Register a domain and help support LQ
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-13-2012, 05:02 AM   #1
walecole
LQ Newbie
 
Registered: Dec 2012
Posts: 3

Rep: Reputation: Disabled
"Trying to count number of string in a /etc/passwd


i tried to count the string that are in the /etc/passwd file that contain 'er' sequence.i used this code but it the not work please can you help me with this.the code i used grep -0 '^ /ete/passwd
 
Old 12-13-2012, 05:07 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Quote:
Originally Posted by walecole View Post
i tried to count the string that are in the /etc/passwd file that contain 'er' sequence.i used this code but it the not work please can you help me with this.the code i used grep -0 '^ /etc/passwd
You do need to tell grep what it is you are looking for (er in your case), you also used the wrong option. Try this:
Code:
grep -c "er" /etc/passwd
Do have a look at the grep manual page for details.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Batch Log File Count number of "unknown userā? algorithm soph75 Linux - Newbie 2 10-14-2014 05:50 AM
[SOLVED] copy string a to string b and change string b with toupper() and count the chars beep3r Programming 3 10-22-2010 08:22 PM
Grub, device string replaced with 32 digit hexadecimal number. Caused Grub "error 11" VipX1 Linux - Newbie 3 10-19-2009 06:27 PM
output the path for files whose names include string "string" (case insensitive) sean_zhang Linux - Newbie 1 03-05-2008 12:59 AM
ask help on "string to number", Csh linux_1 Linux - Desktop 2 10-23-2007 12:31 AM


All times are GMT -5. The time now is 10:34 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration