Results 1 to 2 of 2
Can you find an alternative for
Code:
wc -l
using grep?
Thanks....
- 03-23-2011 #1Just Joined!
- Join Date
- Feb 2011
- Posts
- 22
[SOLVED] wc -l and grep
Can you find an alternative for
using grep?Code:wc -l
Thanks.
- 03-23-2011 #2
What exactly is it that your trying to achieve that you can't use wc -l for? Do you lack access to the wc command?
I don't see how it will be possible to use grep as a complete alternative to wc. You can use the following command to have grep count lines, but it will only be the lines that grep extracted out of the file that match the pattern it was searching for:
This command will suppress grep's normal output and simply prints out the total of lines matching your pattern.Code:grep -c
Unless someone knows better than I, 'grep -c' will be the closest thing to wc that grep can get
I hope this helps.


