noninteractive vi

October 30th, 2007 | Categories: Boring | Tags:

Records here.

#!/bin/ksh
# This script shows how to use 'vi' editor non-interactively.
# Any vi command can be put in the same way. Just prefix the command
# by ':' sign.
# Here the script  removes the blank line in a file and same the same.
# Take file to be modified as command line argument.
# Usage : $0 <filename>

[ $# -ne 1 ] && echo "Usage: $0 <filename>" && exit 1

vi <<-eof
:r $1
:%g/^[\t]*$/d
:wq!
eof



##############################################################################
### This script is submitted to BigAdmin by a user of the BigAdmin community.
### Sun Microsystems, Inc. is not responsible for the
### contents or the code enclosed.
###
###
### Copyright 2007 Sun Microsystems, Inc. ALL RIGHTS RESERVED
### Use of this software is authorized pursuant to the
### terms of the license found at
### http://www.sun.com/bigadmin/common/berkeley_license.html
##############################################################################
Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
No comments yet.