[sllug-members]: Script Question
Clint Savage
herlo1 at gmail.com
Mon May 5 10:26:44 MDT 2008
On Mon, May 5, 2008 at 9:44 AM, Jason Clint <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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://sllug.org/pipermail/sllug-members/attachments/20080505/d201079c/attachment.htm
More information about the sllug-members
mailing list