..."Does not have '=' 0 or more times" is a poor way to describe it; "0 or more characters that aren't a '='", or more simply, "grab characters until you hit a '='" would be more accurate.
Agree!
I has been aplying description automaticaly,
but more precize reading of the [^=]* is:
--- 'not '=' character(s) 0 or more times',
concluding, as you have said:
--- anything, untill '='
Quote:
Originally Posted by BMDan
Try the following as an input:
and you'll understand my change. ...
I've tried:
I see.
So, if the specified string exist more than once, reg-ex selecting last one!
Hm, not obviouse logic!
But, the solution 'until not =' is not the best. How to do the same if defined search part will be, say, 'BOOBOO'?
I am not a guru in reg-ex.
I know in 'patern removal expantion' that situation could be prevented by syntaxis: ${varnm%boo*} - removes first match from end, ${varnm%%boo*} - removes all, as they said - longest match.
Maybe something like that is available for sed regular exprecions, but I do not know.
Agree!
I has been aplying description automaticaly,
but more precize reading of the [^=]* is:
--- 'not '=' character(s) 0 or more times',
concluding, as you have said:
--- anything, untill '='
I've tried:
I see.
So, if the specified string exist more than once, reg-ex selecting last one!
Hm, not obviouse logic!
But, the solution 'until not =' is not the best. How to do the same if defined search part will be, say, 'BOOBOO'?
I am not a guru in reg-ex.
I know in 'patern removal expantion' that situation could be prevented by syntaxis: ${varnm%boo*} - removes first match from end, ${varnm%%boo*} - removes all, as they said - longest match.
Maybe something like that is available for sed regular exprecions, but I do not know.
Each RegEx, as read left-to-right, consumes as many characters as it can. Given that context, perhaps it now makes more sense?
In Perl, one can append the "?" character to specify a non-greedy match--that is, match only as much as is needed to satisfy the condition. In this case, however, there's a simple answer: give it what it wants:
Since sed will match the earliest occurrence of "PASS=" it can find in each line, we've now hit paydirt. There are some corner cases here (like "UNRELATEDVARIABLE=None may PASS= this point."), but all can be defeated by including a test:
Now we get:
Thank you BMDan for explanation.
I remember you have mention about some other potentional problem with that statement. I do not see anythink. Did you changed your mind about that or just have no time and interest to show that?
Hi All,
I need to understand following three environment variables and their usages in HP Unix.
_M_ARENA_OPTS
_M_CACHE_OPTS
PTHREAD_SCOPE_SYSTEM
How does these environment variables influence multi threaded applciation and how do we decide the value of these variables? Is there... (0 Replies)
Hi Everyone,
I need some help with sed and I'm totally new to it.
I have a template file with variables in it. These variables start with a '$' sign and are exactly one character long (plus the '$' sign). For example: $a, $b, etc.
Each variable should be replaced with the contents of a... (9 Replies)
1. The problem statement:
What is the mesg value set for your environment? If it is on, how would you turn off your current
session? How would you set it permanently?
3. The attempts at a solution :
Read Unix The textbook.
3rd chapter has many things like environment variables and... (5 Replies)
Hi Experts,
Need your help in understanding the commands to setup the environment variables in hp-ux.
Beleive need to use either set,setenv or export.
I am confused between above three options, when to use which option?
On command line, I have tried both set and setenv but couldn't... (1 Reply)
Hello Everyone
I need to create a script file which must append some lines to a target text file, I'm using sed for windows, the script file look like this:
{
a\
STRINGTABLE DISCARDABLE\
BEGIN\
5, 150 {a\
#define RC_SHELL, "%ID_SHELL%"\
#define RC_NAME, "%ID_NAME%"\
END
}
... (1 Reply)
Hello,
I want to writte a script that replace two character strings by two variables with the command sed butmy solution doesn't work. I'm written this: sed "s/TTFactivevent/$TTFav/g && s/switchSLL/$SLL/g" templatefile.
I want to replace TTFactivevent by the variable $TTFav, that is a... (4 Replies)
using sed to replace a specific string on a specific line number using variables
this is where i am at
grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean
grep -n Destination... (2 Replies)
hi,
I want to create a new EV(Environment Variable) through a c program and I done this thing through setenv() method. But the newly created EV is not permanent, i.e. when I exit from the program the EV also no longer lives. But I want to make it a permanent EV for the current user. Actually I... (6 Replies)
Hi!
How-to get the environment variables in GNU.
getenv() only fetches the ones that you can find under export (not the ones under declare)...
best regars .David (2 Replies)