[sllug-members]: Script Question

Remo Mattei remo at italy1.com
Mon May 5 10:37:37 MDT 2008


that should do what he wants..

Remo

Clint Savage wrote:
> On Mon, May 5, 2008 at 9:44 AM, Jason Clint <jason_clint at sento.com 
> <mailto:jason_clint at sento.com>> wrote:
> 
>     I am trying to do a Linux script to compare 2 files in some way and only
>     return a certain result.
> 
>     File 1 = /etc/passwd
>     File 2 = nonusers.txt
> 
>     File 2 has all the nonusers in it and I need to make sure my script
>     doesn't accidently pull out any of them.  This is a for a manual ldap
>     import and when I ran the script the first time I had a user named "ns"
>     so it pulled out "ns" and "nscd" which is a nonuser.  Anyway I was
>     trying to use a script to compare the 2 and only return a result that
>     didn't have "nologin" or even just return all results except the ones
>     that were in the status list nonusers.txt.  I'm kind of new at shell
>     scripting so any help would be greatly appreciated.
> 
> 
> diff file1 file2 | grep -v '/sbin/nologin'
> 
> While this would work, I am sure there is a better way with sed or awk.  
> I am just not that skilled as of yet.
> 
> Cheers,
> 
> Clint
> 
> 
> 
> 
> 
> 
>  
> 
> !DSPAM:481f37a7180871540612102!
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________________________________
> See http://www.sllug.org/ for latest SLLUG news, information, links.
> Join SLLUG and other UT LUG members on irc.FreeNode.net channel #Utah
> sllug-members at sllug.org
> http://www.sllug.org/cgi-bin/mailman/listinfo/sllug-members
> 
> 
> !DSPAM:481f37a7180871540612102!


More information about the sllug-members mailing list