home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / share / elvis-2.2_0 / scripts / wc.ex < prev    next >
Encoding:
Text File  |  2004-02-22  |  292 b   |  13 lines

  1. "This script defines a :wc alias, which counts words
  2.  
  3. alias wc {
  4.  "Count chars, words, and lines in the current file, or a given range of lines
  5.  local c=0 w=0 l=0 nolocked
  6.  !%g/^/ {
  7.   let l=l+1
  8.   let c=c+strlen(line()) + 1
  9.   try s/\w\+/let w=w+1/xg
  10.  }
  11.  calc c "chars," w "words," l "lines"
  12. }
  13.