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 $OUPUT
From: chloe K chloekcy2...@yahoo.ca
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
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
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
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
On Wed, Jun 17, 2009 at 10:54 AM, chloe Kchloekcy2...@yahoo.ca 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;
On Wed, Jun 17, 2009 at 11:16 AM, Brianemailli...@beckerspace.com 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
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 emailli...@beckerspace.com wrote:
Can I use this
for i `cat
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 Kchloekcy2...@yahoo.ca 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
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 part
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 for your help
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
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
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
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
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
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
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
On Mon, Jun 8, 2009 at 4:29 PM, Tom Brownt...@ng23.net 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
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
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
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
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 are
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
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
On Mon, Jun 8, 2009 at 5:29 AM, Tom Brownt...@ng23.net 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
Hi.
echo foo.bar.VALUE.baz.lala | awk -F. '{ print $(NF-2); }'
--
Alex S.magicb...@gmail.com
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
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 =
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.dk
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
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)}'
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
I need
On Mon, 2009-06-08 at 08:01 -0400, William L. Maltby wrote:
snip
2. Inside that, use the set command to change the field separator to .
snip
Correction: IFS (the Interfield Separator) is just another variable.
Just regular assignment will set it.
--
Bill
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
list centos@centos.org
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 kok wrote:
Hi Phil
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 copy
Ross S. W. Walker wrote:
Try:
# find parent dir -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
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
directories!
I did think
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' olddir
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
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
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
If you are just
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't
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
___
CentOS
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:^
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
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 , , }
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 remotely
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, however i
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
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
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
53 matches
Mail list logo