[oclug] VI search and replace problem
Bart Trojanowski
bart-oclug at jukie.net
Sat Jul 12 13:16:18 EDT 2003
* Brenda J. Butler <bjb at istop.com> [030712 01:17]:
> Or you can do it with tr instead of vi:
>
> cat textfile | tr -s ' ' > textfile.squeezed
>
> "Squeeze" multiple occurences of space to a single occurence
> with the translate (tr(1)) utility.
Or better yet, use tr in vim:
1) select some text using 'V' command,
2) type in :!tr -s ' ' and push enter.
# Note the vi command line will read
# :'<,'>!tr -s ' '
# where '<,'> denotes the selected block
The block of text you selected will be parsed through tr -s ' ' and the
original block will be replaced with the output of your command.
B.
--
WebSig: http://www.jukie.net/~bart/sig/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://tux.oclug.on.ca/pipermail/oclug/attachments/20030712/4f009d10/attachment.bin
More information about the OCLUG
mailing list