DISQUS

DISQUS Hello! Elliott Back's Blog is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Replace, Grep — Elliott C. Back

Started by elliottback · 8 months ago

No excerpt available. Jump to website »

4 comments

  • %grep 'think' jean-thinks.txt | wc -l
    14

    BOOYAH!
    :^)
  • Sorry stran, that doesn't work. That will give you:

    %grep ‘think' jean-thinks.txt | wc -l
    6


    See, grep counts lines, and there are only 6 lines with 'think' in them. You really need to split think onto seperate lines first, although the slashes got lost in the post...
  • Why not use sed? Perl seems like an overkill. And no need for a temporary file if u pipe it.

    sed s/think/think\n/g jean-thinks.txt | grep think | wc -l
  • I used temporary files because for some reason piping this stuff on windows doesn't work properly (i.e., like unix). If I were on linux, Xander, you got it ;)

Add New Comment

Returning? Login