LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "Trying to count number of string in a /etc/passwd (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-count-number-of-string-in-a-etc-passwd-4175441268/)

walecole 12-13-2012 04:02 AM

"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

druuna 12-13-2012 04:07 AM

Quote:

Originally Posted by walecole (Post 4848305)
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.


All times are GMT -5. The time now is 01:24 PM.