Shell script

brad brad at bradandkim.net
Tue Nov 11 22:38:47 CST 2003


Thanks for the help...that is exactly what I am wanting to do, but it is
not working for me.  When I go into vi and type :/g/
it won't let me hit tab then...I just get the beep that I am doing
something wrong.  

Thoughts?

Thanks,

Brad

Scott wrote:

> A two step process
> 
> Step #1 vi your FILE and then:
> 
> :/g/(TABHERE)/s//|/g
> :wq
> 
> This replaces the TAB with the | symbol.  It's just an old habit of mine that
> tends to make life easier for me sometimes.  At least it's consistant.
> 
> 
> 
> Step #2 Put in this shell script and run it with cat FILE|./SHELLSCRIPT
> 
> 
> #!/bin/sh
> while read ALINE
> do
> IFS=|
> /usr/sbin/useradd -c "$1 Account Whatever Comment Here" $1
> echo $2 | /usr/bin/passwd --stdin $1
> done
> 
> 
> You may have to tweak around with this a touch..  But it should do the job for
> you.  The script creates the account with default settings and then puts the
> password in for you using the passwd command.  The --stdin option to passwd is
> generally not documented well, if at all, but it's there in every distribution
> I've used.
> 
> scottm
> 
> 
> 
> ========================================
> Scott D. Medlock          scottm at epicalliance.com
> 
> Epic Alliance, Inc.	http://www.epicalliance.com
> 913.227.0660 ext 27
> ========================================
> 
> 




More information about the Kclug mailing list