Dear Chloe,
John Doe`s script is a good start, even though it will work for single
words space separated. The LINE Variable only passes the Arguments as single
words to ($1 and $2 respectively). I will also work on something for you
too...
On Thu, Jun 18, 2009 at 10:34 AM, John Doe wrote:
>
>
From: chloe K
> I have a file. list.txt (two columns)
>
> column1column2
> nameaddress
>
> I need to put in the letter file letter.txt eg:
>
> Dear: Chloe
> Address: CA
>
> Can I use this
>
> for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g' $i.letter.txt
For single wo
Hi
If your file has only 2 columns and there is no space exists in 2nd
column then you can use this script
#!/bin/sh
FILE="list.txt"
OUTPUT="out.txt"
while read VAL
do
VAL1=$(echo $VAL | awk '{print $1}' )
VAL2=$(echo $VAL | awk '{print $2}' )
echo "DEAR: $VAL1" >> $OUPUT
echo "DEAR: $VAL2"
chloe K wrote:
> Hi
>
> I have a file. list.txt (two columns)
>
> column1column2 nameaddress
>
>
> I need to put in the letter file letter.txt eg:
>
> Dear: Chloe Address: CA
>
> Can I use this
>
> for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g' $i.letter.txt
>
> Thank you
On Wed, 17 Jun 2009 11:16:58 -0700 MHR wrote:
>
>
>I've never seen any shell or sed syntax that allows you to subscript a
>line like this. You should read up on awk, although there is no
>simple way to do dual file processing along these lines.
Easy way to do this with awk is to have the first pa
Hi Chloe,
Please start by reading this:
http://www.catb.org/~esr/faqs/smart-questions.html
On Wed, Jun 17, 2009 at 13:54, chloe K wrote:
> I have a file. list.txt (two columns)
Separated by what? Tabs? Spaces? Can the fields themselves have spaces
in them? Do you have many records, one per row?
There is going to be a problem with your sed line as the semi-column is not
helping matters. You can try using a database for easy retrieval with your
script. I hope it puts you on the way.
On Wed, Jun 17, 2009 at 7:16 PM, Brian wrote:
> > Can I use this
> >
> > for i `cat list.txt` | sed 's/Chl
On Wed, Jun 17, 2009 at 11:16 AM, Brian wrote:
>> Can I use this
>>
>> for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g' $i.letter.txt
>>
>
> Why don't you just try it and see if it works?
There _is_ that, but it won't
:-)
mhr
___
CentOS mailin
On Wed, Jun 17, 2009 at 10:54 AM, chloe K wrote:
> Hi
>
> I have a file. list.txt (two columns)
>
> column1 column2
> name address
>
> I need to put in the letter file letter.txt eg:
>
> Dear: Chloe
> Address: CA
>
> Can I use this
>
> for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g'
> Can I use this
>
> for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g' $i.letter.txt
>
Why don't you just try it and see if it works?
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
Hi
I have a file. list.txt (two columns)
column1 column2
name address
I need to put in the letter file letter.txt eg:
Dear: Chloe
Address: CA
Can I use this
for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g' $i.letter.txt
Thank you for your help
_
On Mon, 2009-06-08 at 08:01 -0400, William L. Maltby wrote:
>
> 2. Inside that, use the set command to change the field separator to "."
>
Correction: IFS (the Interfield Separator) is just another variable.
Just regular assignment will set it.
--
Bill
___
On Mon, 2009-06-08 at 10:29 +0100, Tom Brown wrote:
> Hi
>
> I need some logic to work out a value for me - this value is _always_
> the 3rd last field in a string seperated by '.' but the string could be
> 5 or 6 fields long, e.g
>
> foo.bar.VALUE.baz.lala
>
> foor.bar.gigi.VALUE.baz.lala
>
On Mon, Jun 08, 2009 at 10:56:09AM +0100, Tom Brown wrote:
>
> >echo foo.bar.VALUE.baz.lala | awk -F. '{ print $(NF-2); }'
>
> excellent - just what i needed
awk is probably the most readable way. In traditional shell stuff like
this used to be done in awk or sed
awk -F. '{print $(NF-2)}
>echo foo.bar.VALUE.baz.lala | awk -F. '{ print $(NF-2); }'
>
>
excellent - just what i needed
thanks
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
muhammad panji wrote:
...
> awk -F\. {'print $3'}
> awk -F\. {'print $5'}
> awk -F\. {'print $6'}
awk -F\. {'print $(NF-2)'}
Mogens
--
Mogens Kjaer, Carlsberg A/S, Computer Department
Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark
Phone: +45 33 27 53 25, Mobile: +45 22 12 53 25
Email: m...@crc.d
> I am pretty sure there is a way in awk to figure out how many fields
> you have, then take the total # of fields -3 each time to get the
> third last one. Just heading out the door and off hand can't remember
> how it would be done.
>
>
i can do it in cheetah templating with
set myloc = $g
Hi.
echo foo.bar.VALUE.baz.lala | awk -F. '{ print $(NF-2); }'
--
Alex S.
On 08.06.2009 13:29, Tom Brown wrote:
> Hi
>
> I need some logic to work out a value for me - this value is _always_
> the 3rd last field in a string seperated by '.' but the string could be
> 5 or 6 fields long, e.g
On Mon, Jun 8, 2009 at 5:29 AM, Tom Brown wrote:
> Hi
>
> I need some logic to work out a value for me - this value is _always_
> the 3rd last field in a string seperated by '.' but the string could be
> 5 or 6 fields long, e.g
>
> foo.bar.VALUE.baz.lala
>
> foor.bar.gigi.VALUE.baz.lala
>
> I need
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Is there anyway you can tell which field it will be in (i.e. to use as
a search clause, so "search for the field with X properties"?)
Ultimately to get the data in the X'th field you are going to need
either awk or sed (they can both easily do this, awk probably easier
than sed)
You need to work
michael.ket...@rm-solutions.de wrote:
> Sehr geehrte Damen und Herren,
>
> ich bin ab dem 15.06.2009 wieder zurück im Büro.
> Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
> [simon.schilli...@rm-solutions.de]
>
> Viele Grüße,
> Michael Kettel
You can resubcribe then, when you
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
On Mon, Jun 8, 2009 at 4:29 PM, Tom Brown wrote:
> Hi
>
> I need some logic to work out a value for me - this value is _always_
> the 3rd last field in a string seperated by '.' but the string could be
> 5 or 6 fields long, e.g
>
> foo.bar.VALUE.baz.lala
>
> foor.bar.gigi.VALUE.baz.lala
>
> I need
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Sehr geehrte Damen und Herren,
ich bin ab dem 15.06.2009 wieder zurück im Büro.
Bitte wenden Sie sich in dringenden Fällen an Simon Schillings
[simon.schilli...@rm-solutions.de]
Viele Grüße,
Michael Kettel
___
CentOS mailing list
CentOS@centos.org
h
Hi
I need some logic to work out a value for me - this value is _always_
the 3rd last field in a string seperated by '.' but the string could be
5 or 6 fields long, e.g
foo.bar.VALUE.baz.lala
foor.bar.gigi.VALUE.baz.lala
I need to find VALUE - if this were python or something i could do it
b
Michael D. Kralka wrote:
>
> Ross S. W. Walker wrote:
> >
> > Try:
> >
> > # find -type d -name dir-192.168.\* -exec mv \{\} `echo
> > \{\} | sed 's/192\.168\./10\.0\./'` \;
> >
> > That should recursively rename all directories from one
> naming scheme to
> > another.
>
> ... except for the
[EMAIL PROTECTED] wrote:
Was there an problem with Frank's response from earlier?
rename 192.168 10.0 dir*
Bah! It's too simple! :-)
--
Toby Bluhm
Midwest Instruments Inc.
30825 Aurora Road Suite 100
Solon Ohio 44139
440-424-2240
___
CentO
iling list
Sent: Fri Nov 02 09:28:45 2007
Subject: Re: [CentOS] script help
I run it but it has error.
sed 's/^dir-192\.168/dir-10\.0/'`
sed: read error on dir-192.168.0.31: Is a directory
--- Toby Bluhm <[EMAIL PROTECTED]> wrote:
> Toby Bluhm wrote:
> > adrian ko
>
> I run it but it has error.
>
> sed 's/^dir-192\.168/dir-10\.0/'`
> sed: read error on dir-192.168.0.31: Is a directory
>
Was there an problem with Frank's response from earlier?
rename 192.168 10.0 dir*
It is a nice simple solution. You don't have to loop, or use extra
commands, just co
Ross S. W. Walker wrote:
>
> Try:
>
> # find -type d -name dir-192.168.\* -exec mv \{\} `echo
> \{\} | sed 's/192\.168\./10\.0\./'` \;
>
> That should recursively rename all directories from one naming scheme to
> another.
... except for the fact that the `echo \{\} ...` will be evaluated by
t
I run it but it has error.
sed 's/^dir-192\.168/dir-10\.0/'`
sed: read error on dir-192.168.0.31: Is a directory
--- Toby Bluhm <[EMAIL PROTECTED]> wrote:
> Toby Bluhm wrote:
> > adrian kok wrote:
> >> Hi Phil
> >>
> >> thank you
> >>
> >> But I have several hundred those pattern
> directorie
Toby Bluhm wrote:
adrian kok wrote:
Hi Phil
thank you
But I have several hundred those pattern directories!
I did think to cat those directories in a file
"olddir"
eg:
dir-192.168.30.0 dir-192.168.30.144 dir-192.168.30.184
and sed 's/dir-192.168/d
adrian kok wrote:
Hi Phil
thank you
But I have several hundred those pattern directories!
I did think to cat those directories in a file
"olddir"
eg:
dir-192.168.30.0
dir-192.168.30.144
dir-192.168.30.184
and sed 's/dir-192.168/dir-10.0/g' olddi
On Fri, 02 Nov 2007 03:18:35 +0800 (CST)
adrian kok <[EMAIL PROTECTED]> wrote:
> But I have several hundred those pattern directories!
What's wrong with the rename command?
--
MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com
___
CentO
Hi Phil
thank you
But I have several hundred those pattern directories!
I did think to cat those directories in a file
"olddir"
eg:
dir-192.168.30.0
dir-192.168.30.144
dir-192.168.30.184
and sed 's/dir-192.168/dir-10.0/g' olddir > newdir
but i don
On Fri, 2007-11-02 at 02:22 +0800, adrian kok wrote:
> Hi all
>
> how can I have script to rename the following
> directory pattern from
>
>
>
> from
>
> dir-192.168.30.0
> dir-192.168.30.144
> dir-192.168.30.184
>
>
> To:
>
>
> dir-10.0.30.0
> dir-10.0.30.144
> dir-10.0.30.184
adrian kok wrote:
Hi all
how can I have script to rename the following
directory pattern from
from
dir-192.168.30.0
dir-192.168.30.144
dir-192.168.30.184
To:
dir-10.0.30.0
dir-10.0.30.144
dir-10.0.30.184
If this is to rename individual files from 192.168.30.0=>192.168.30.14
On Fri, 02 Nov 2007 02:22:30 +0800 (CST)
adrian kok <[EMAIL PROTECTED]> wrote:
> how can I have script to rename the following
> directory pattern from
>
> dir-192.168.30.0To: dir-10.0.30.0
rename 192.168 10.0 dir*
--
MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com
___
Hi all
how can I have script to rename the following
directory pattern from
from
dir-192.168.30.0
dir-192.168.30.144
dir-192.168.30.184
To:
dir-10.0.30.0
dir-10.0.30.144
dir-10.0.30.184
thank you
Send instant messages to your online friends http://uk.messenger.yahoo.com
_
On Fri, Oct 26, 2007 at 06:56:05PM +0800, Anup Shukla wrote:
> MOUNTER=`ssh $i "mount | grep data | awk '{print \\$1,\\$2,\\$3}'"`
>
> This is what i tried and worked for me.
Why not be simpler, run the "mount" on the remote machine but the grep
and awk on the local machine; no quoting issue at
Correction.
MOUNTER=`ssh $i "mount | grep data | awk '{print \\$1,\\$2,\\$3}'"`
This is what i tried and worked for me.
bingo! gold star - thanks!!
I need to query mount as these are nfs mounts configre by an automounter
and so not in the fstab
__
On Fri, Oct 26, 2007 at 11:52:50AM +0100, Luciano Rocha wrote:
> On Fri, Oct 26, 2007 at 11:28:37AM +0100, Tom Brown wrote:
> > Hi
> >
> > I am sure the answer here is really easy but i am stuck!
> >
> > # mount | grep data | awk '{print$1,$2,$3}'
> >
> > gives me the info i require locally,
On Fri, Oct 26, 2007 at 11:28:37AM +0100, Tom Brown wrote:
> Hi
>
> I am sure the answer here is really easy but i am stuck!
>
> # mount | grep data | awk '{print$1,$2,$3}'
>
> gives me the info i require locally, however i need to execute this over
> about 1000 hosts so i run things remot
Anup Shukla wrote:
Tom Brown wrote:
How about
# MOUNTER=`ssh $i "mount | grep data | awk '{print \$1,\$2,\$3}'"`
alas no
MOUNTER=`ssh $i 'mount | grep data | awk "{print \$1, \$2, \$3}"'`
results in
awk: {print , , }
awk:^ syntax error
awk: {print , , }
awk: ^ syntax err
Tom Brown wrote:
How about
# MOUNTER=`ssh $i "mount | grep data | awk '{print \$1,\$2,\$3}'"`
alas no
MOUNTER=`ssh $i 'mount | grep data | awk "{print \$1, \$2, \$3}"'`
results in
awk: {print , , }
awk:^ syntax error
awk: {print , , }
awk: ^ syntax error
awk: {print , , }
How about
# MOUNTER=`ssh $i "mount | grep data | awk '{print \$1,\$2,\$3}'"`
alas no
MOUNTER=`ssh $i 'mount | grep data | awk "{print \$1, \$2, \$3}"'`
results in
awk: {print , , }
awk:^ syntax error
awk: {print , , }
awk: ^ syntax error
awk: {print , , }
awk:
How about
# MOUNTER=`ssh $i "mount | grep data | awk '{print \$1,\$2,\$3}'"`
alas no
MOUNTER=`ssh $i 'mount | grep data | awk "{print \$1, \$2, \$3}"'`
results in
awk: {print , , }
awk:^ syntax error
awk: {print , , }
awk: ^ syntax error
awk: {print , , }
awk:^
Tom Brown wrote:
# MOUNTER=`ssh $i 'mount | grep data | awk '{print$1,$2,$3}''`
How about
# MOUNTER=`ssh $i "mount | grep data | awk '{print \$1,\$2,\$3}'"`
Regards
A.S
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/list
On Oct 26, 2007, at 6:28, Tom Brown wrote:
I am sure the answer here is really easy but i am stuck!
Getting the quoting right for remote commands in the shell is never
an easy thing :-).
# mount | grep data | awk '{print$1,$2,$3}'
gives me the info i require locally, however i need to ex
Hi
I am sure the answer here is really easy but i am stuck!
# mount | grep data | awk '{print$1,$2,$3}'
gives me the info i require locally, however i need to execute this over
about 1000 hosts so i run things remotely using ssh something like
# MOUNTER=`ssh $i 'mount | grep data | awk '{pri
58 matches
Mail list logo