[svlug] Two stupid FAQ questions about VI...

Seth David Schoen schoen at uclink4.berkeley.edu
Mon Nov 30 12:36:02 PST 1998


Ivica Steffl writes:

>   fmt is in slackware distribution, I do not know how standard it is.

It's in GNU textutils, so it will be on pretty much ever Linux system.
It's also on BSD, SunOS, and SCO.

> > 2) How do I count the number of words in the buffer?
> 
>   you can also use above ! command - just go to the first line of the
> text (1G) then press !wc and hit the enter key and whole text is
> replaced by output of wc (wordcount) program, saying how many words and
> lines do you have in file, then press 'u' to undo the change (the output
> of the wc command will be replaced by the previously present text)

Unfortunately, that doesn't work -- you need to give a range for the !
command.  "!wc <enter>" from command mode will select the current line
(because of the "w" command) and then try to filter it through "c".
 
>   then there's :[range]w !wc possibility (where range is standard range,
> you can use other command instead of wc), text within range will be
> feeded to command and standard output of command will be displayed (it
> will not overwrite the content of file like the previous way of counting
> words). after the output of the command is displayed you are prompted to
> press return.

Ooh, cool!  I didn't realize the difference between

:[range]w! wc

and

:[range]w !wc

That spaces makes a lot of difference.

-- 
   Seth David Schoen L&S '01 (undeclared) / schoen at uclink4.berkeley.edu
He said, "This is what the king who will reign over you will do."  And they
said, "Nay, but we will have a king over us, that we also may be like all the
nations." (1 Sam 8)  http://ishmael.geecs.org/~sigma/   http://www.loyalty.org/

--
echo "unsubscribe svlug" | mail majordomo at svlug.org
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ to unsubscribe
see http://www.svlug.org/mdstuff/lists.shtml for posting guidelines.



More information about the svlug mailing list