sed search and wc

I have a file of the following

>!#jjdjahfjdhfjkds
aklsjdlkasdkashfjkdshfkjdsbfnbsdkjnfbdsk
>*kfjhdsafjdshjfkhdsjkfhdsk
wuyruiewyrieyueytireuytreyu
>-jdfhsjsjkdhfd
xzmncxzbvnmcxbvbcxn

I would like to do a wc for the lines starting with >

For the above example, the result is 3.

Thanks in advance.

Hi.

You can easily do that with grep

$ grep -c '^>' file
3
1 Like
grep -c "^>" inputfile
grep "^>" inputfile | wc -l

-------------------
Late post: Already answered by Scott

1 Like