Author |
Message |
Rajesh B Marchappanava #1 / 8
|
 grep-ing a string in csh
Is there something like TCL's regexp in csh. Basically, can i grep a string in csh. Thanks, Rajesh
|
Tue, 31 May 2005 03:45:37 GMT |
|
 |
those who know me have no need of my nam #2 / 8
|
 grep-ing a string in csh
in comp.unix.shell i read:
no.
yes, using command substitution, echo and grep. as an aside: don't script using csh. -- bringing you boring signatures for 17 years
|
Tue, 31 May 2005 03:55:09 GMT |
|
 |
Rajesh B Marchappanava #3 / 8
|
 grep-ing a string in csh
those who know me have no need of my name wrote:
How could i check if a string say, "Roses are red" contained "red" in it using command substitution, echo and grep?
I have to search DISPLAY variable in .cshrc to figure out if i have logged into my account from home or work, so i have no choice but to use csh or change my login shell itself. Thanks, Rajesh
|
Tue, 31 May 2005 04:24:24 GMT |
|
 |
those who know me have no need of my nam #4 / 8
|
 grep-ing a string in csh
in comp.unix.shell i read:
lots of ways. and it's basic csh scripting, so i hope i'm not answering your homework without your having learned something. the straightforward method, that doesn't even use command substitution since it's just a test is: echo "Roses are red" | grep -q red if ($status == 0) then echo red is present endif
i'd suggest the later. but, why do you need to do this? i'm not doubting that you have some purpose, nor trying to cast your purpose into doubt, but if we understand what you want to do it might be that something simple(r) is possible. -- bringing you boring signatures for 17 years
|
Tue, 31 May 2005 05:11:21 GMT |
|
 |
Barry Margoli #5 / 8
|
 grep-ing a string in csh
In article <3DF8F078.7B7DD...@cisco.com>, Rajesh B Marchappanavar <rmarc...@cisco.com> wrote:
Perhaps something like this is what you want: if ( "$DISPLAY" =~ *.homeisp.net:* ) then ... else ... endif -- Barry Margolin, bar...@genuity.net Genuity, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
|
Tue, 31 May 2005 05:25:48 GMT |
|
 |
Rajesh B Marchappanava #6 / 8
|
 grep-ing a string in csh
those who know me have no need of my name wrote:
I have a sun workstation at work and i use gvim editor at work, when working from home i connect to my desktop at work using VPN. I cannot use gvim at home because gvim window doesn't get redirected to my windows pc at home. I have to set my EDITOR env variable based on from where i am connected. So i am checking DISPLAY to set EDITOR to either vi or gvim. If there is a simpler way out of this, please let me know. I truely appreciate all the help. BTW this is no "homework" problem this is just "work from home" problem. :-) Thanks a lot, Rajesh
-- Rajesh 12/12/02 --------------------------------------------------------------------------- Words may be false and full of art, Sighs are the natural language of the heart. ---------------------------------------------------------------------------
|
Tue, 31 May 2005 05:31:40 GMT |
|
 |
Rajesh B Marchappanava #7 / 8
|
 grep-ing a string in csh
Thanks a lot Barry, this exactly what i am looking for. Thank you, Rajesh
|
Tue, 31 May 2005 05:44:13 GMT |
|
 |
those who know me have no need of my nam #8 / 8
|
 grep-ing a string in csh
in comp.unix.shell i read:
barry's pattern match (not a regular expression though) is probably what you want. but there are other possibilities which depend on the method you use to connect from home, as well as your desires. e.g., if you are using ssh then it already provides an x11 tunnel, so it might be useful to install a x server on your home machine. this isn't simple in and of itself, but the results mean that your DISPLAY will be set appropriately, automatically, and you'll have access to all the x utilities which you are used to using at work. -- bringing you boring signatures for 17 years
|
Tue, 31 May 2005 06:24:43 GMT |
|
 |
|