Re: Scripting question

2012-04-17 Thread Daniel Landau
On Tue, Apr 17, 2012 at 4:52 PM, Eduardo M KALINOWSKI wrote: > On Ter, 17 Abr 2012, Chris wrote: >> I would like have the Smtp: replaced with To:  leaving all that follows in >> each line untouched and piped into a new file. > > man sed > Read that too, but try also searching online for "sed tuto

Re: Scripting question

2012-04-17 Thread emmanuel segura
perl -e 'while(<>){chomp; s/root/Root/g; print "$_\n"; }' /etc/passwd Il giorno 17 aprile 2012 15:52, Eduardo M KALINOWSKI < edua...@kalinowski.com.br> ha scritto: > On Ter, 17 Abr 2012, Chris wrote: > >> Firstly I petty much suck at scripting so I need help. >> >> I have a file where each lin

Re: Scripting question

2012-04-17 Thread Eduardo M KALINOWSKI
On Ter, 17 Abr 2012, Chris wrote: Firstly I petty much suck at scripting so I need help. I have a file where each line begins with Smtp: I would like have the Smtp: replaced with To: leaving all that follows in each line untouched and piped into a new file. man sed -- The majority of hu

Re: scripting question: to parse data with varname=value pattern the easiest way?

2010-11-02 Thread Zhang Weiwu, Beijing
On 11/02/2010 05:04 AM, Karl Vogel wrote: >On the other hand, if someone sneaks something like >result_04: dc="3" rm /something/valuable Thank you! very informative, and, kinda fun to read. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscr

Re: scripting question: to parse data with varname=value pattern the easiest way?

2010-11-01 Thread Karl Vogel
>> On Mon, 01 Nov 2010 15:49:01 +0800, >> Zhang Weiwu said: Z> A program output is like this: Z> result_01: a="23" b="288" c="A_string" ac="34" Z> result_02: a="23" b="28" c="A_string_too" dc="3" Z> Z> I am writing a script to output values of b if b is in the result set. If your

Re: scripting question

2009-07-02 Thread Marc Shapiro
Kumar Appaiah wrote: On Wed, Jul 01, 2009 at 09:28:23AM -0500, Kumar Appaiah wrote: for i in *zzz;do mv "$i" $(echo "$i"|sed 's/^...//'); done But I'd recommend one of these: mrename, krename, gprename, renameutils and more (all apt-gettable, of course). Oh, and I think prename (or just renam

Re: scripting question

2009-07-01 Thread gcrimp
On Wed, Jul 01, 2009 at 07:22:33AM -0700, Marc Shapiro wrote: > I am sure that this is an easy question for those people who do any > reasonable amount of scripting. I'm just not one of them. > > How can I rename all of the files ina directory with the new name being > the old name stripped of

Re: scripting question

2009-07-01 Thread Michael Ekstrand
Marc Shapiro writes: > I am sure that this is an easy question for those people who do any > reasonable amount of scripting. I'm just not one of them. > > How can I rename all of the files ina directory with the new name > being the old name stripped of its leftmost three characters. If all > of

Re: scripting question

2009-07-01 Thread Teemu Likonen
On 2009-07-01 18:20 (+0300), Teemu Likonen wrote: > find -type f -print0 | xargs -0 sh -c 'for file in "$@"; > do dir=$(dirname -- "$file") && base=$(basename -- "$file") && > (cd "$dir" && echo mv -- "$base" "${base#???}"); done' ignore Let's simplify it a bit: find -type f

Re: scripting question

2009-07-01 Thread Teemu Likonen
On 2009-07-01 07:22 (-0700), Marc Shapiro wrote: > How can I rename all of the files ina directory with the new name > being the old name stripped of its leftmost three characters. If all > of the files are off the format: > > xxxy.zzz > > I want the new names to be of th

Re: scripting question

2009-07-01 Thread Boyd Stephen Smith Jr.
In <4a4b7129.7010...@yahoo.com>, Marc Shapiro wrote: >I am sure that this is an easy question for those people who do any >reasonable amount of scripting. I'm just not one of them. > >How can I rename all of the files ina directory with the new name being >the old name stripped of its leftmost thr

Re: scripting question

2009-07-01 Thread Scott Gifford
Marc Shapiro writes: [...] > How can I rename all of the files ina directory with the new name > being the old name stripped of its leftmost three characters. My favorite way to do this is with sed and xargs. First have sed print the current name, then use an regexp to change it to the new

Re: scripting question

2009-07-01 Thread Kumar Appaiah
On Wed, Jul 01, 2009 at 09:28:23AM -0500, Kumar Appaiah wrote: > On Wed, Jul 01, 2009 at 07:22:33AM -0700, Marc Shapiro wrote: > > How can I rename all of the files ina directory with the new name > > being the old name stripped of its leftmost three characters. If > > all of the files are off the

Re: scripting question

2009-07-01 Thread Kumar Appaiah
On Wed, Jul 01, 2009 at 07:22:33AM -0700, Marc Shapiro wrote: > How can I rename all of the files ina directory with the new name > being the old name stripped of its leftmost three characters. If > all of the files are off the format: > > xxxy.zzz > > I want the new na

Re: Scripting Question - tar

2008-07-11 Thread T o n g
On Thu, 10 Jul 2008 17:04:38 -0500, Kent West wrote: >> tar -cvzf - --one-file-system /home | split -b 2000m - Side note since the problem has been solved. You might want to look into dar, which will do splitting for you automatically, as well as many other desired features for backup (incremen

Re: Scripting Question - tar

2008-07-10 Thread Kent West
Owen Townend wrote: Kent West wrote: Am I just not seeing a typo somewhere? Why is my script failing? Hey, You're missing the '-' for stdin tar -czvf - --one-file-system $sourceDir | split -b 2000m - $targetFile Ah, thank you! -- Kent West <")))>< West

Re: Scripting Question - tar

2008-07-10 Thread Owen Townend
> > tar -cvzf - --one-file-system /home | split -b 2000m - > /TERASTATIONBACKUP/GOSHEN/2008/2008-Jul-10.tgz vs > > tar -czvf - --one-file-system $sourceDir | split -b 2000m $targetFile > Am I just not seeing a typo somewhere? Why is my script failing? > > Thanks! Hey, You're missing the '-' fo

Re: scripting question

2008-01-06 Thread Matus UHLAR - fantomas
On 21.09.07 08:18, Michael Martinell wrote: > My script is as follows: > #!/bin/sh > > TERM=vt100 > export TERM forcing TERM in script is very bad idea, and in this script also useless. > date && echo " Spam Count" && /bin/more /var/log/syslog | /bin/grep -c > 'identified spam' && echo " " && ec

Re: scripting question

2007-09-22 Thread Jude DaShiell
One possible approach would be to use a few files and use paste on those files where: dfile holds date, mfile holds good messages, sfile holds spam messages tfile is temporary file paste dfile mfile >tfile paste tfile sfile >dfile rm mfile rm sfile rm tfile cat dfile hth. -- To UNSUBSCRIB

Re: scripting question

2007-09-21 Thread Peter Teunissen
On 21-sep-2007, at 15:51, Michael Martinell wrote: Thanks - that was exactly what I was looking for. Now I just need to find a good scripting tutorial. :) Try http://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html That's where I learned my scripting basics. Peter -- To UNSUBSCRI

RE: scripting question

2007-09-21 Thread Michael Martinell
Thanks - that was exactly what I was looking for. Now I just need to find a good scripting tutorial. :) -Original Message- From: Michael Marsh [mailto:[EMAIL PROTECTED] Sent: Friday, September 21, 2007 8:38 AM To: debian-user@lists.debian.org Subject: Re: scripting question On 9/21/07

Re: scripting question

2007-09-21 Thread Michael Marsh
On 9/21/07, Michael Martinell <[EMAIL PROTECTED]> wrote: > I have a simple script that counts up the number of spam messages each day > and prints the total number into a text field. This is fine as far as it > goes, however I would like to also include the date and the number of > non-spam messag

Re: scripting question

2007-09-21 Thread Neil Watson
Man echo reveals that the -n switch prevents echo from appending a new line. Also, you do not need to use more (or less) with grep. Grep can take a file agrument. Refer to grep's man page for more information. -- Neil Watson | Debian Linux System Administrator| Uptime 6 days ht

Re: Scripting question

2006-06-20 Thread Zane Dodson
Hello Anil, On Tue, Jun 20, 2006 at 03:36:49PM +0530, Anil Gupte wrote: | OK, I figured out the problem, but not the solution. The output is | actually from a SQL query. The output looks like this (when echoed): | | Serial_Number | TLO03 | | It is getting the field name and the field valu

Re: Scripting question

2006-06-20 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anil Gupte wrote: > OK, I figured out the problem, but not the solution. The output > is actually from a SQL query. The output looks like this (when > echoed): > > Serial_Number TLO03 > > It is getting the field name and the field value as two

Re: Scripting question

2006-06-20 Thread Nyizsnyik Ferenc
- > From: "Hal Vaughan" <[EMAIL PROTECTED]> > To: > Sent: Monday, June 19, 2006 11:00 PM > Subject: Re: Scripting question > > > > On Monday 19 June 2006 13:00, Anil Gupte wrote: > >> Why does > >> > >> echo /l3dat/${Serial_Nuum

Re: Scripting question

2006-06-20 Thread Anil Gupte
www.icinema.com - Original Message - From: "Hal Vaughan" <[EMAIL PROTECTED]> To: Sent: Monday, June 19, 2006 11:00 PM Subject: Re: Scripting question On Monday 19 June 2006 13:00, Anil Gupte wrote: Why does echo /l3dat/${Serial_Nuumber}.tar.gz give me /l3dat/ TLO3.

Re: Scripting question

2006-06-19 Thread Hal Vaughan
On Monday 19 June 2006 13:00, Anil Gupte wrote: > Why does > > echo /l3dat/${Serial_Nuumber}.tar.gz > > give me > > /l3dat/ TLO3.tar.gz > > In other words, why is it putting an etra space in there (after the > second /) and how can I get rid of it? > > And yes, there is no space there. I check

Re: Scripting question

2006-06-19 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anil Gupte wrote: > Why does > > echo /l3dat/${Serial_Nuumber}.tar.gz > > give me > > /l3dat/ TLO3.tar.gz > > In other words, why is it putting an etra space in there (after > the second /) and how can I get rid of it? > > And yes, there is no

Re: Scripting question

2006-06-19 Thread Zane Dodson
Hello Anil, On Mon, Jun 19, 2006 at 10:30:16PM +0530, Anil Gupte wrote: | Why does | | echo /l3dat/${Serial_Nuumber}.tar.gz ^^ Is this a typo? | | give me | | /l3dat/ TLO3.tar.gz | | Serial_Number=${Serial_Number##" "} | | and the variable prints the same before an