Re: [SLUG] script help with grep or regex ?

2014-01-14 Thread Darragh Bailey
Hi, or in perl :) If there is other data in front | perl -ne 'if (<> =~ /(? wrote: > > "lists" == lists writes: > > lists> I have a shell script that gets a web page, after around half > lists> dozen sed/awk one liners I end up with like[1]: > > lists> I would like to extract all the 7 dig

Re: [SLUG] script help with grep or regex ?

2014-01-14 Thread peter
> "lists" == lists writes: lists> I have a shell script that gets a web page, after around half lists> dozen sed/awk one liners I end up with like[1]: lists> I would like to extract all the 7 digit numeric values, lists> currently starting with '313', to use them further in the lists> s

Re: [SLUG] script help with grep or regex ?

2014-01-13 Thread Jiří Baum
Hi, > the page is reasonably constant (until any fixes?) Yeah, that's always a danger... > all the values I want are in a single 6000 char line, how do I break the > 6000 char line into individual vaules, 'grep any_value file' gives me the > whole 6000 chars ? Several ways, probably the easiest

Re: [SLUG] script help with grep or regex ?

2014-01-13 Thread lists
On Tue, January 14, 2014 1:31 pm, Jiří Baum wrote: > Ah, skip the lynx step. Just work with the html directly. > All the tools (sed, awk, grep) can work directly with html. > To some extent it depends on how variable the original page is. > Once you skip the lynx step, you might even find that

Re: [SLUG] script help with grep or regex ?

2014-01-13 Thread Jiří Baum
Hi, > thanks. I think you might have anwsered my next question already: > what I'm doing is like: wget url > html; lynx html > text Ah, skip the lynx step. Just work with the html directly. All the tools (sed, awk, grep) can work directly with html. > even it's somewhat outside of my abilities

Re: [SLUG] script help with grep or regex ?

2014-01-13 Thread lists
On Tue, January 14, 2014 12:45 pm, kfos...@tpg.com.au wrote: > There are man html reader libraries out there. I have used one for perl > for example. It enables you to look for some other tag to find your data > (eg > the css class name of that particular element) and rip the data by walking >

Re: [SLUG] script help with grep or regex ?

2014-01-13 Thread kfoskey
will get specific recommendations on html reader / parser libraries. (eg html agility for C#) Ta Ken -Original Message- From: li...@sbt.net.au Sent: Tuesday, January 14, 2014 12:35 PM To: slug@slug.org.au Subject: [SLUG] script help with grep or regex ? I have a shell script that gets

[SLUG] script help with grep or regex ?

2014-01-13 Thread lists
I have a shell script that gets a web page, after around half dozen sed/awk one liners I end up with like[1]: I would like to extract all the 7 digit numeric values, currently starting with '313', to use them further in the script I'm hoping there is some better way ? (rather what I'm doing,

Re: [SLUG] script help with unexpected token/variable

2011-08-21 Thread Nick Andrew
On Mon, Aug 22, 2011 at 09:55:34AM +1100, Voytek Eymont wrote: > # archmail aa.com.au > /usr/local/bin/archmail: line 19: syntax error near unexpected token `sudo' > /usr/local/bin/archmail: line 19: ` sudo -u#5000 archivemail -d90 $j ' > > script: > -- > # cat /u

Re: [SLUG] script help with unexpected token/variable

2011-08-21 Thread Voytek Eymont
On Mon, August 22, 2011 11:37 am, Chris Donovan wrote: >> for j in *@* > do >>  sudo -u#5000  archivemail -d90 $j >> done Chris, thanks all's working good -- Voytek -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq

Re: [SLUG] script help with unexpected token/variable

2011-08-21 Thread Chris Donovan
> for j in *@* do >  sudo -u#5000  archivemail -d90 $j > done Chris- -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

[SLUG] script help with unexpected token/variable

2011-08-21 Thread Voytek Eymont
I have a short script (which I think? used to work on the old server...) that I'm having problems with: I want to run archivemail against all mailboxes in: /var/mail/vhosts/domain.tld/*@domain.tld this is what I need to run: :/var/mail/vhosts/aa.com.au# sudo -u#5000 archivemail -d90 r...@aa.com

Re: [SLUG] script help

2008-07-16 Thread Amos Shapira
2008/7/16 Voytek Eymont <[EMAIL PROTECTED]>: > > On Wed, July 16, 2008 10:05 am, [EMAIL PROTECTED] wrote: > > > Dave, > thanks > > I think I have brackets or quotes wrong? He used input redirection instead of a pipe: > mutt -s "Traffic Report East Inner West" [EMAIL PROTECTED] < echo "${trafrep}"

Re: [SLUG] script help

2008-07-16 Thread Voytek Eymont
On Wed, July 16, 2008 10:05 am, [EMAIL PROTECTED] wrote: Dave, thanks I think I have brackets or quotes wrong? # ./t ./t: line 5: echo: No such file or directory #!/bin/bash trafrep=$(lynx -dump http://rta.nsw.gov.au/trafficreports/sydney/sydney_east_inner_west.html | sed -n -e '/Last refr

Re: [SLUG] script help

2008-07-15 Thread Peter Hardy
On Wed, 2008-07-16 at 09:39 +1000, Voytek Eymont wrote: > I'm trying to put together a basic script to get 'on demand' traffic info > to my handheld, all commands more or less work as desired, but, I would > like to make a 'proper script' out of it: > > I guess I should put the 'temp' files in /va

Re: [SLUG] script help

2008-07-15 Thread daveg
#!/bin/bash trafrep=$(lynx -dump http://rta.nsw.gov.au/trafficreports/sydney/sydney_east_inner_west.html | sed -n -e '/Last refreshed/{:a;N;/Road Works/!ba;p;}') wget -q http://rta.nsw.gov.au/trafficreports/cameras/camera_images/citywestlink.jpg -O- | jpegtran -rotate 270 > citymap.jpg mutt -

Re: [SLUG] script help

2008-07-15 Thread daveg
For starters I guess you could throw in a -q to wget to stop it from outputting but I guess sending output to /dev/null (as long as you aren't fussed when things fail) should be enough. Quoting Voytek Eymont <[EMAIL PROTECTED]>: I'm trying to put together a basic script to get 'on demand' t

[SLUG] script help

2008-07-15 Thread Voytek Eymont
I'm trying to put together a basic script to get 'on demand' traffic info to my handheld, all commands more or less work as desired, but, I would like to make a 'proper script' out of it: I guess I should put the 'temp' files in /var/tmp ? and, send screen output to /dev/null ? any help or suggest

Re: [SLUG] Script help

2005-09-21 Thread Vino Fernando Crescini
scini Sent: Thu, 22. September 2005 3:47 PM To: SLug Users Subject: Re: [SLUG] Script help #!/bin/bash while read name; do grep $name smbpasswd; done < allusers.txt are the names in allusers.txt listed one per line? -- Vino Fernando Crescini Intelligent Systems La

Re: [SLUG] Script help

2005-09-21 Thread Vino Fernando Crescini
#!/bin/bash while read name; do grep $name smbpasswd; done < allusers.txt are the names in allusers.txt listed one per line? -- Vino Fernando Crescini Intelligent Systems Laboratory School of Computing & IT phone: +61 2 4736 0140 Univer

[SLUG] Script help

2005-09-21 Thread Simon
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 smbp

Re: [SLUG] Script Help

2005-05-11 Thread [EMAIL PROTECTED]
It would seem using somthing like xargs may be appropriate. xargs Xargs will ensure the command argument buffer is chopped into appropriate sized chunks. Cheers Shane Peter Miller <[EMAIL PROTECTED]> wrote: On Wed, 2005-05-11 at 13:58 +1000, Julio Cesar Ody wrote: > $ for dirname in `c

Re: [SLUG] Script Help

2005-05-11 Thread Matthew Hannigan
On Wed, May 11, 2005 at 03:24:58PM +1000, Rick Welykochy wrote: > In C, one wouldn't (I hope) call a function and then ignore possible > error return, i.e. > [ ] > So why eschew the same when programming in the shell? > > while read name; do >if cd $name; then > rm -fvr * >

RE: [SLUG] Script Help

2005-05-10 Thread Simon
M > To: slug@slug.org.au > Subject: Re: [SLUG] Script Help > > > * On Wed, May 11, 2005 at 01:48:35PM +1000, Simon wrote: > > Hi all, > > Why is the following script ripping out every directory rather than > > just those in 'studentfile' > > > >

Re: [SLUG] Script Help

2005-05-10 Thread Rick Welykochy
Simon wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Rundle Sent: Wed, 11. May 2005 2:11 PM To: SLUG Subject: Re: [SLUG] Script Help Simon scribed; Why is the following script ripping out every directory rather than just those in

Re: [SLUG] Script Help

2005-05-10 Thread Julio Cesar Ody
Yeah, I replied, but not to the list. It follows: // begin reply // Still, the previous reply makes an interesting point that I overlooked. Using star in "rm -r" is reckless, in general. But by issuing a "rm -rf $name" will remove the directory along with it's contents, whereas "rm -rf $name/*"

Re: [SLUG] Script Help

2005-05-10 Thread Alexander Samad
On Wed, May 11, 2005 at 02:10:40PM +1000, Peter Rundle wrote: > Simon scribed; > > >Why is the following script ripping out every directory rather than just > >those in 'studentfile' > > > >#!/bin/bash > >while read name; do > >cd $name > >rm -fvr * > >cd .. > >rmdir $name > >done < studentlist >

Re: [SLUG] Script Help

2005-05-10 Thread Sonia Hamilton
* On Wed, May 11, 2005 at 01:48:35PM +1000, Simon wrote: > Hi all, > Why is the following script ripping out every directory rather than just > those in 'studentfile' > > #!/bin/bash > while read name; do > cd $name Fails here if directory $name doesnt exist; next line deletes everything. > rm

RE: [SLUG] Script Help

2005-05-10 Thread Simon
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Peter Rundle > Sent: Wed, 11. May 2005 2:11 PM > To: SLUG > Subject: Re: [SLUG] Script Help > > > Simon scribed; > > >Why is the following script ripping out

Re: [SLUG] Script Help

2005-05-10 Thread Peter Miller
On Wed, 2005-05-11 at 13:58 +1000, Julio Cesar Ody wrote: > $ for dirname in `cat studentlist`; do rm -rf $dirname/*; done cat studentlist | while read dirname; do rm -rf $dirname/*; done this will cope more elegantly with large numbers of line in the slug student list file. The line

Re: [SLUG] Script Help

2005-05-10 Thread Peter Rundle
Simon scribed; Why is the following script ripping out every directory rather than just those in 'studentfile' #!/bin/bash while read name; do cd $name rm -fvr * cd .. rmdir $name done < studentlist Repeat after me: "Never use a star with rm -r !" In your script what will happen if there is a

Re: [SLUG] Script Help

2005-05-10 Thread Julio Cesar Ody
> Why is the following script ripping out every directory rather than just > those in 'studentfile' You mean "studentlist"? Anyway, you could try: $ for dirname in `cat studentlist`; do rm -rf $dirname/*; done Will remove everything inside each folder listed in a file called studentlist, locate

Re: [SLUG] Script Help

2005-05-10 Thread Vino Fernando Crescini
Simon wrote: Hi all, Why is the following script ripping out every directory rather than just those in 'studentfile' #!/bin/bash while read name; do cd $name rm -fvr * cd .. rmdir $name done < studentlist while read name; do rm -fvr $name done < studentlist -- Vino Fernando Crescini

[SLUG] Script Help

2005-05-10 Thread Simon
Hi all, Why is the following script ripping out every directory rather than just those in 'studentfile' #!/bin/bash while read name; do cd $name rm -fvr * cd .. rmdir $name done < studentlist OLMC Simon Bryan IT Manager [EMAIL PROTECTED] LMB 14 North Parra

Re: [SLUG] Script help needed

2001-04-25 Thread Simon Bryan
Thanks for the help. I seem to have it working satisfactorily now. At 11:47 26/04/2001, you wrote: >Simon Bryan wrote: > > > > Just checking, you are saying I should actually create a password, > >Yes > > > just > > make it random > >Yes > > > (the script will do this for me), > >The examples I g

Re: [SLUG] Script help needed

2001-04-25 Thread John Ferlito
On Thu, Apr 26, 2001 at 11:04:43AM +1000, Simon Bryan wrote: > HI, > I have a script I downloaded and have been able to make a couple of mods > to. The script is called Addpopusers and takes input from a text file and > creates the users for me. However now I do not want to create passwords as

Re: [SLUG] Script help needed

2001-04-25 Thread Del
Simon Bryan wrote: > > HI, > I have a script I downloaded and have been able to make a couple of mods > to. The script is called Addpopusers and takes input from a text file and > creates the users for me. However now I do not want to create passwords as > the system will authenticate against an

[SLUG] Script help needed

2001-04-25 Thread Simon Bryan
HI, I have a script I downloaded and have been able to make a couple of mods to. The script is called Addpopusers and takes input from a text file and creates the users for me. However now I do not want to create passwords as the system will authenticate against an NT server using PAM. The user