i have submitted the following command to the command
prompt
onet="EXSR U@POPN";ABC="EXSR U@POPN";def="CALLP
UPRTOPEN";sed1_str=`echo $onet | sed
"s/$ABC/$def/"`;echo $sed1_str
and the output i expect is "CALLP UPRTOPEN"
but i m getting the output as "EXSR U@POPN"
Note:when i remove a single space in onet and ABC
variables i m getting the out put as CALLP UPRTOPEN
--- Cameron Simpson <cs@xxxxxxxxxx> wrote:
---------------------------------
Please do not top post. Post inline and trim quoted
material for
relevance. Please reply to the list, not to me
personally.
On 18May2006 07:59, srikanth master
<chinna_567@xxxxxxxxxxx> wrote:
| spaces are handled correctly if the variable has
only
| one space in between the words.
No, they are handled correctly regardless.
| for example:
| variable A has a value "abc ebc"
| and variable B has value "def fgr"
| not sed will work fine if we want to replace A with
B
| in some file.
|
| Note: the varibles A and B has only one space in
| between the words.
|
| The problem comes when there are more than one space
| in the variables
| like A="abc ebc" and B="def fgr".
|
| this is not working in the sed command.
You are going to have to demonstrate this (because I
know it to be
false). Please provide an example with values for $A
and $B, some example
input data line, the desired output data lines, and
the output lines
you actually get.
Then I can reproduce it and explain what you should be
doing
differently.
Cheers,
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/
1st Law Economists: For every economist there exists
an equal and opposite
economist.
2nd Law Economists: They're both always wrong!
--
SPONSORED LINKS
Accounting software program
Anti virus software program
Calendar software program
Tax
software program
Program retail software
Payroll software program
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "sed-users" on the web.
To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.
---------------------------------
Send instant messages to your online friends
http://in.messenger.yahoo.com
Send instant messages to your online friends
http://in.messenger.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
--
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/
<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: handling spaces in sed command
Please do not top post. Post inline and trim quoted material for
relevance. Please reply to the list, not to me personally.
On 18May2006 07:59, srikanth master <chinna_567@xxxxxxxxxxx> wrote:
| spaces are handled correctly if the variable has only
| one space in between the words.
No, they are handled correctly regardless.
| for example:
| variable A has a value "abc ebc"
| and variable B has value "def fgr"
| not sed will work fine if we want to replace A with B
| in some file.
|
| Note: the varibles A and B has only one space in
| between the words.
|
| The problem comes when there are more than one space
| in the variables
| like A="abc ebc" and B="def fgr".
|
| this is not working in the sed command.
You are going to have to demonstrate this (because I know it to be
false). Please provide an example with values for $A and $B, some example
input data line, the desired output data lines, and the output lines
you actually get.
Then I can reproduce it and explain what you should be doing
differently.
Cheers,
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/
1st Law Economists: For every economist there exists an equal and opposite
economist.
2nd Law Economists: They're both always wrong!
------------------------ Yahoo! Groups Sponsor --------------------~-->
You can search right from your browser? It's easy and it's free. See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
--
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/
<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Next Message by Date:
click to view message preview
Re: Swapping fields around
Ruud H.G. van Tol schreef:
> With () you surround a matching group.
Only if you have -E available. Otherwise use \( \).
--
Groet, Ruud
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
--
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/
<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Previous Message by Thread:
click to view message preview
Re: handling spaces in sed command
Please do not top post. Post inline and trim quoted material for
relevance. Please reply to the list, not to me personally.
On 18May2006 07:59, srikanth master <chinna_567@xxxxxxxxxxx> wrote:
| spaces are handled correctly if the variable has only
| one space in between the words.
No, they are handled correctly regardless.
| for example:
| variable A has a value "abc ebc"
| and variable B has value "def fgr"
| not sed will work fine if we want to replace A with B
| in some file.
|
| Note: the varibles A and B has only one space in
| between the words.
|
| The problem comes when there are more than one space
| in the variables
| like A="abc ebc" and B="def fgr".
|
| this is not working in the sed command.
You are going to have to demonstrate this (because I know it to be
false). Please provide an example with values for $A and $B, some example
input data line, the desired output data lines, and the output lines
you actually get.
Then I can reproduce it and explain what you should be doing
differently.
Cheers,
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/
1st Law Economists: For every economist there exists an equal and opposite
economist.
2nd Law Economists: They're both always wrong!
------------------------ Yahoo! Groups Sponsor --------------------~-->
You can search right from your browser? It's easy and it's free. See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
--
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/
<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Next Message by Thread:
click to view message preview
Re: handling spaces in sed command
AGAIN I ask you to not top post. It's very very annoying.
On 18May2006 09:21, srikanth master <chinna_567@xxxxxxxxxxx> wrote:
| i have submitted the following command to the command
| prompt
|
| onet="EXSR U@POPN";ABC="EXSR U@POPN";def="CALLP
| UPRTOPEN";sed1_str=`echo $onet | sed
| "s/$ABC/$def/"`;echo $sed1_str
|
| and the output i expect is "CALLP UPRTOPEN"
| but i m getting the output as "EXSR U@POPN"
You need quotes in the echo commands:
echo "$onet"
echo "$sed1_str"
and so forth. Your sed is fine. The input data is wrong because echo is
being handed two strings EXSR and U@POPN, and printing them with one
space between. With quotes, echo gets _one_ string "EXSR U@POPN"
and prints it literally - the spaces there are part of the string.
Cheers,
--
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/
Artificial intelligence won't make a micrometer out of a monkeywrench.
- Rick Gordon <rickg@xxxxxxx>
------------------------ Yahoo! Groups Sponsor --------------------~-->
You can search right from your browser? It's easy and it's free. See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
--
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/
<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/