Berkeley CSUA MOTD:Entry 14592
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2024/11/23 [General] UID:1000 Activity:popular
11/23   

1998/9/14-16 [Computer/SW/Unix] UID:14592 Activity:very high
9/13    How do you write a regular expression to NOT include a certain
        string wihtout grep -v... say I was to no include Tue but want Thu
        so ^[^T] wont work. I dont have to do [^T][^u][^e] do I?
        \_ [^T][^u][^e] won't work -- that doesn't match Thu.  If you want
           to match any three-character sequence except Tue with standard
           regexps, you have to do something like this: [^T]..|.[^u].|..[^e]
           (That reads: anything whose first character isn't T, or whose
           second character isn't u, etc.)  If you're using perl, it's much
           easier: (?!Tue) will match anything that isn't Tue.

           There might also be an easier way.  What are you trying to do?
           \_ shouldnt it be [^T].. & .[^u]. & ..[^e]??  if you use or,
              you wouldnt get a match for Thu since it starts with T?
              \_ The caret inside brackets means "not": [^T] matches any
                 character that is not a T.
                 \_ therefore, Thu will not be matched since it starts
                    with 'T'??
                    \_ No, because of the "|" ("or") operator: it will be
                       matched because its second character is not "u" (.[^u].)
                       and because those patterns were joined with or
                       operators.  Compare "a|b" -- it matches "b" even though
                       "b" is not "a".  It's really a clever application of
                       De Morgan's law to regexps.
                        \_ oh yeah...duh...stupid me... thanks.
         \_ or if you specifically know  you're always matching
            the output of `date`, for example, you could just use '^..[^e]'
            seeing as how that does not match Mon|Wed|Thr|Fri|Sat|Sun
                \_I am wondering about a general solution. Say I want
                to grep "last" for everyone logging on Tue but NOT from
                http://berkeley.edu. Can I do that with one egrep and not
                last | grep Tue | grep -v http://berkeley.edu?
                \_ Not easily.  What's wrong with calling grep twice?
                      \_Because I need to pass a single regular expression
                        to a differnt program.  I am only using grep to test
                        the regular expression for the other program.  I cannot
                        call the other program twice.
                        \_ This is too general. Why not use awk or perl to
                           pass the correct arguments to the second
                           program? Why do you want to pass a regexp? --dim
                           \_ I am not a UNIX newbie.  I thought about using
                                two different regular expressions but that just
                                isn't an option.  It has to be done in one pass.
                                \_ You sound like a newbie.  Why can't you use
                                   awk of perl as dim suggested?  -not dim
                                        \-you are begging the question. i can
                                certainly think of cases where you cant pipe to
                                to multiple greps. say you are doing an fgrep
                                type thing and have a file of regexps, one per
                                line. --psb
                                \_ Suppose I invent some totally arbitary and
                                   unrelated case to support my meaningless
                                   point?  Was it an African or a European
                                   swallow?  Who cares?
                                   \_ the swallow. Or, alternatively, the
                                      "swallow-ee".
                                        \-you know i talked to the person who
                                        asked the question. my example is
                                        actually pretty close to the real
                                        problem --psb
                                        \_ Exactly.  As I saifd, African or
                                           European?
                                \_ Is there a regular expression for a valid
                                UNIX UID?  That is faster than testing if it
                                is between 0 and 65000 on each line, isn't it?
                                \_ define "valid UNIX UID"
                                        \_ How about regexp for a number
                                        between 0 and 65678?
                                                \_ Recent Solaris versions
                                                   support UIDS > 64K -ax
ERROR, url_link recursive (eces.Colorado.EDU/secure/mindterm2) 2024/11/23 [General] UID:1000 Activity:popular
11/23   

You may also be interested in these entries...
2012/8/29-11/7 [Computer/SW/Security] UID:54467 Activity:nil
8/29    There was once a CSUA web page which runs an SSH client for logging
        on to soda.  Does that page still exist?  Can someone remind me of the
        URL please?  Thx.
        \_ what do you mean? instruction on how to ssh into soda?
           \_ No I think he means the ssh applet, which, iirc, was an applet
              that implemented an ssh v1 client.  I think this page went away
	...
2012/3/29-6/4 [Computer/HW/Memory, Computer/HW/CPU, Computer/HW/Drives] UID:54351 Activity:nil
3/29    A friend wants a PC (no mac). She doesn't want Dell. Is there a
        good place that can custom build for you (SSD, large RAM, cheap video
        card--no game)?
        \_ As a side note: back in my Cal days more than two decades ago when
           having a 387SX made me the only person with floating-point hardware,
           most machines were custom built.
	...
2012/1/27-3/26 [Computer/SW/Unix] UID:54299 Activity:nil
1/27    Interesting list of useful unix tools. Shout out to
        cowsay even!
        http://www.stumbleupon.com/su/3428AB/kkovacs.eu/cool-but-obscure-unix-tools
        \_ This is nice.  Thanks.
	...
2011/10/26-12/6 [Computer/SW/Unix] UID:54202 Activity:nil
10/24  What's an easy way to see if say column 3 of a file matches a list of
       expressions in a file? Basically I want to combine "grep -f <file>"
       to store the patterns and awk's $3 ~ /(AAA|BBB|CCC)/ ... I realize
       I can do this with "egrep -f " and use regexp instead of strings, but
       was wondering if there was some magic way to do this.
       \_ UNIX has no magic. Make a shell script to produce the ask or egrep
	...
2011/3/12-4/20 [Consumer/CellPhone, Computer/HW/Laptop] UID:54057 Activity:nil
3/12    I am curious what others think of tablets like iPad. They don't seem
        useful to me, but I use my computer for more than web browsing,
        Facebook, and Twitter. Why would I buy one instead of a laptop?
        They seem like a disabled laptop to me, but at a higher price.
        \_ You are most likely a coder.  iPad is not for coders.  They are
           what you get your non-technical friends.  Or musicians.  Look at
	...
2011/2/6-19 [Computer/Networking] UID:54028 Activity:nil
2/5     hmm.
$netstat -at | grep LISTEN
tcp        0      0 *:43300                 *:*                     LISTEN
        \_ this is an sshd
tcp        0      0 *:49416                 *:*                     LISTEN
tcp        0      0 *:36201                 *:*                     LISTEN
	...
2010/3/10-30 [Computer/SW/Mail] UID:53751 Activity:nil
3/10    What email program do people in Cal CS use nowadays?  In my school days
        people used /usr/bin/mail, then RMail in emacs, then VMail in emacs.
        After my days people used Elm, Pine, Mutt (I forgot which order).  In
        my first two jobs we could tell the seniority of fellow engineers based
        on which email program they use at work, because everyone used what
        they used to use in their school years.  In my last two jobs though,
	...
2009/11/13-30 [Computer/SW/Unix] UID:53523 Activity:nil
11/12   How does one find out if a system has rootkit installed?
        \_ Unix or m$?
           \_ Unix. On M$ I always assume it's compromised.
              \_ Install Tripwire before you plug your server into The Net?
                 The only other answer I can think of is to reinstall the
                 OS from scratch on another server and do an md checksum
	...
2009/9/4-12 [Computer/SW/OS/FreeBSD] UID:53331 Activity:kinda low
9/4     I'm seriously very happy Soda no longer runs FreeBSD.
        FreeBSD is really going down the tubes
        http://freebsdgirl.com/2009/08/its-a-dirty-job-but-someone-ha.html
        \_ funny, I dont remember it geting pwned anywhere near as many tmies
           as it has since the switch to Linux.  And that blog post is
           only abou the installer, not the running OS
	...
Cache (73 bytes)
berkeley.edu
For a text-only version of the campus home page, please follow this link.