Re: [SLUG] FW: Script help

2005-09-24 Thread Matthew Hannigan
On Fri, Sep 23, 2005 at 10:07:14PM -0700, Angus Lees wrote:
 Since apparently I've been getting some experience with large datasets
 lately, this version scales better:
 
  sort allusers.txt  sortedusers.txt
  sort /etc/samba/smbpasswd | join -v1 -t: -o1.1 - sortedusers.txt | \
xargs -n 1 smbpasswd -x

Yes, similarly if both files are simple and sorted, 'comm'
is the 'standard' way to deal with this.

Matt
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] FW: Script help

2005-09-23 Thread Angus Lees
At Thu, 22 Sep 2005 17:01:24 +1000, Vino Fernando Crescini wrote:
  If you want a list of all invalid usernames in smbpasswd that is
  not in allusers.txt, this way might be easier:
  cut -d: -f1 smbpasswd | while read name; do
grep -q ${name}\$ /tmp/list || echo $name
  done
 
 oops. that's allusers.txt instead of /tmp/list. the output of
 this can then be fed to smbpasswd -x

Since apparently I've been getting some experience with large datasets
lately, this version scales better:

 sort allusers.txt  sortedusers.txt
 sort /etc/samba/smbpasswd | join -v1 -t: -o1.1 - sortedusers.txt | \
   xargs -n 1 smbpasswd -x

-- 
 - Gus
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] FW: Script help

2005-09-22 Thread Simon
Hmmm, just loaded the allusers.txt file into pico and did a write out
and it now works, must have still been a windows file. Now my modified
procedure is below but I only get one entry in the newlist file (either
the last one in allusers or the last processed if I interrupt it.

#!/bin/bash
while read name; do
grep $name smbpasswd  newlist;
done  allusers.txt




-Original Message-
From: Simon [mailto:[EMAIL PROTECTED] 
Sent: Thu, 22. September 2005 3:34 PM
To: SLug Users (slug@slug.org.au)
Subject: Script help


Hi all,
Can anyone tell me why I get no output from this script? I am not good
at writing my own so modify others. I have tested that it is reading the
allusers.txt by adding an echo $name

#!/bin/bash
while read name; do
grep $name smbpasswd;
done  allusers.txt

My basic problem is I have an smbpasswd file where for a couple of years
users were not removed properly so that there are about 350 extra users
in the smbpasswd file - I want to cut it down to the right size - and be
able to reuse the usernames. I have a complete list 'allusers.txt' of
all the valid users. Once this worked I was just going to pipe the
output to a nwe file.

OLMC
Simon Bryan
IT Manager
[EMAIL PROTECTED]
LMB 14
North Parramatta
Direct Number:88381200
SwitchBoard: 96833300
fax: 98901466
mobile: 0414238002


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] FW: Script help

2005-09-22 Thread Vino Fernando Crescini



Hmmm, just loaded the allusers.txt file into pico and did a write out
and it now works, must have still been a windows file. Now my modified
procedure is below but I only get one entry in the newlist file (either
the last one in allusers or the last processed if I interrupt it.

#!/bin/bash
while read name; do
grep $name smbpasswd  newlist;
done  allusers.txt


The  redirection will overwrite the file if it exists. Use 
to append to the file.

--
Vino Fernando Crescini Intelligent Systems Laboratory
   School of Computing  IT
phone: +61 2 4736 0140 University of Western Sydney
email: [EMAIL PROTECTED] Locked Bag 1797
web: www.cit.uws.edu.au/~jcrescin  Penrith South DC NSW 1797

Scanned by SCIT E-Mail Gateway http://www.cit.uws.edu.au


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] FW: Script help

2005-09-22 Thread Vino Fernando Crescini




Hmmm, just loaded the allusers.txt file into pico and did a write out
and it now works, must have still been a windows file. Now my modified
procedure is below but I only get one entry in the newlist file (either
the last one in allusers or the last processed if I interrupt it.

#!/bin/bash
while read name; do
grep $name smbpasswd  newlist;
done  allusers.txt


If you want a list of all invalid usernames in smbpasswd that is
not in allusers.txt, this way might be easier:

cut -d: -f1 smbpasswd | while read name; do
  grep -q ${name}\$ /tmp/list || echo $name
done

--
Vino Fernando Crescini Intelligent Systems Laboratory
   School of Computing  IT
phone: +61 2 4736 0140 University of Western Sydney
email: [EMAIL PROTECTED] Locked Bag 1797
web: www.cit.uws.edu.au/~jcrescin  Penrith South DC NSW 1797

Scanned by SCIT E-Mail Gateway http://www.cit.uws.edu.au


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] FW: Script help

2005-09-22 Thread Matthew Hannigan
On Thu, Sep 22, 2005 at 04:22:38PM +1000, Vino Fernando Crescini wrote:
 
 #!/bin/bash
 while read name; do
 grep $name smbpasswd  newlist;
 done  allusers.txt
 
 The  redirection will overwrite the file if it exists. Use 
 to append to the file.

Or move the  newlist to the last line


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] FW: Script help

2005-09-22 Thread Vino Fernando Crescini



If you want a list of all invalid usernames in smbpasswd that is
not in allusers.txt, this way might be easier:

cut -d: -f1 smbpasswd | while read name; do
  grep -q ${name}\$ /tmp/list || echo $name
done



oops. that's allusers.txt instead of /tmp/list. the output of
this can then be fed to smbpasswd -x

--
Vino Fernando Crescini Intelligent Systems Laboratory
   School of Computing  IT
phone: +61 2 4736 0140 University of Western Sydney
email: [EMAIL PROTECTED] Locked Bag 1797
web: www.cit.uws.edu.au/~jcrescin  Penrith South DC NSW 1797

Scanned by SCIT E-Mail Gateway http://www.cit.uws.edu.au


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


RE: [SLUG] FW: Script help

2005-09-22 Thread Simon
Thanks everyone, all sorted

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Vino Fernando Crescini
Sent: Thu, 22. September 2005 5:01 PM
Cc: 'SLug Users'
Subject: Re: [SLUG] FW: Script help



 If you want a list of all invalid usernames in smbpasswd that is not

 in allusers.txt, this way might be easier:
 
 cut -d: -f1 smbpasswd | while read name; do
   grep -q ${name}\$ /tmp/list || echo $name
 done
 

oops. that's allusers.txt instead of /tmp/list. the output of this can
then be fed to smbpasswd -x

-- 
Vino Fernando Crescini Intelligent Systems Laboratory
School of Computing  IT
phone: +61 2 4736 0140 University of Western Sydney
email: [EMAIL PROTECTED] Locked Bag 1797
web: www.cit.uws.edu.au/~jcrescin  Penrith South DC NSW 1797

Scanned by SCIT E-Mail Gateway http://www.cit.uws.edu.au


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html