Originally posted by: ergeorge
Ok, here's an example from some work I was doing yesterday afternoon of the command line being far more powerful.
I think I have a problem with a slew rate assignment in a code I work with. So, as a starting point, I want to see every assignment to a variable named slew_rate in the whole directory tree. Except it may be spelled a variety of ways:
slewrate
slew_rate
SlewRate
SLEWRATE
Slewing_Rate
SlewRate1
Slew_Rate2
slwrate
etc....
I don't want to see stuff like
MaxSlewRate
Slew_Rate_Max
I only want to see assignments, so there should be an '=' following the variable (with some or no whitespace), and the variable should be at the beginning of the line (potentially with some amount of whitespace)
I also want to see the two lines preceeding each of these matches, for possible comments, and one line following for longer assignments.
I want to see the filename/path and line number for each match also.
How do I do this:
> grep -rin -B2 -A1 "^[ \t]*/<sl[e]?w[-]?rate[0-9]?[\t]*=" base_code_dir
Now I'm sure all you windows people are looking at this as a poster child for why you don't want anything to do with a command line.
But think about it. This took me maybe 2 or 3 minutes to write & execute to accomplish everything that I described above. Sure, it took me awhile to learn grep & regular expressions. But now it's easy.
How would you do this in windows?
If you have a nice GUI IDE that could do this for you, how much did it cost? How well would it work over a relatively slow network connection to a machine about 1000 miles away?
What was your learning curve to accomplish this on that IDE?
Now I look at these results and see that I'm really interested in SlewRate1, but I want 4 lines of following context. I hit the up arrow key, and edit the previous line:
> grep -rn -B2 -A3 "^[ \t]*/<SlewRate1[\t]*=" base_code_dir
Now I see that what I really need to see is the assignments to variables called azimuth_rate and elevation_rate in the file base_code_dir/tools/read_sensors.cc
> grep -n -B2 -A1 "^[ \t]*/<(azimuth_rate|elevation_rate)[ \t]*=" base_code_dir/tools/read_sensors.cc
Also note that I can send these lines to other developers, and if they know regular expressions, they know exactly what I'm doing. So, If I want to consult with somebody else on the azimuth_rate assignment, I e-mail them the last regex, and my results, and they can run it against their code tree for comparison. How long would it take to communicate your windows method for doing this to somebody else?
Again, their is certainly a relatively steep learning curve. But once you climb it, it has tremendous power.
Originally posted by: Ameesh
use findstr!!!!! it does the same fvcking thing as grep!!!
Originally posted by: gopunk
like i posed earlier, do you refuse to shop in stores with security cameras? do you refuse to buy cd's with antitheft devices on them? what about clothes?
Originally posted by: notfred
Originally posted by: gopunk
like i posed earlier, do you refuse to shop in stores with security cameras? do you refuse to buy cd's with antitheft devices on them? what about clothes?
If everytime I bought a pair of pants, I had to pay for them, take them home, then call the store back and ask "Can I wear my pants now?" and hope they said yes, and then if I wanted to wear my pants with a different shirt, call them backand say "I changed my shirt, can I get permission to wear my pants with the new shirt?" No, I would not buy pants from that retailer.
Originally posted by: gopunk
Originally posted by: notfred
Originally posted by: gopunk
like i posed earlier, do you refuse to shop in stores with security cameras? do you refuse to buy cd's with antitheft devices on them? what about clothes?
If everytime I bought a pair of pants, I had to pay for them, take them home, then call the store back and ask "Can I wear my pants now?" and hope they said yes, and then if I wanted to wear my pants with a different shirt, call them backand say "I changed my shirt, can I get permission to wear my pants with the new shirt?" No, I would not buy pants from that retailer.
you missed the point. he was ranting about how he was being treated like a criminal. you are being treated like a criminal in the examples i gave. yet people don't mind that.
btw the reason why your example is so ricockulous is because unlike software, clothing can only be used by one person at one time.
You guys are both retards for this particular opinion (gopunk was probably being facetious but who cares). First off, UNIX has been around for ages and has excelled in the workstation and server markets for many years. People use it because it works, and often works better than Windows. Windows established solid (not perfect) stability just two years ago and everybody is supposed to switch to it because you feel it's faster and more efficient? People are different; it's completely brain-dead for you to say everyone would benefit most from using Windows, but instead Linux geeks just want to be different.Originally posted by: gopunk
I agree that for some applications windows isn't up to par, but it still seems the *nix crowd is an elitist bunch who is using it for the sake of being different and anti-MS, even though what they are doing is already being done by windows in a faster and more efficient manner.
mm... yea, linux peopleunix people are cool... (and use it out of necessity)
Originally posted by: gopunk
Originally posted by: notfred
Originally posted by: gopunk
like i posed earlier, do you refuse to shop in stores with security cameras? do you refuse to buy cd's with antitheft devices on them? what about clothes?
If everytime I bought a pair of pants, I had to pay for them, take them home, then call the store back and ask "Can I wear my pants now?" and hope they said yes, and then if I wanted to wear my pants with a different shirt, call them backand say "I changed my shirt, can I get permission to wear my pants with the new shirt?" No, I would not buy pants from that retailer.
you missed the point. he was ranting about how he was being treated like a criminal. you are being treated like a criminal in the examples i gave. yet people don't mind that.
btw the reason why your example is so ricockulous is because unlike software, clothing can only be used by one person at one time.
Originally posted by: gopunk
Originally posted by: civad
ms gives away a ton of software.... i got 3 copies of xp pro and 2 copies of visual studio .net for free. most of the giveaways are to developers and students.
someone i know is a developer and he has copies of visual studio/office/xp/2000 up the yazoo
Originally posted by: manly
A lot of those geeks used Windows (and DOS) for years as well. If WInblows was the best thing since sliced bread, then nobody would have even considered switching away. The bottom line is no one tool is perfect, and different people appreciate different products. But that concept appears a little too profound for some people to understand.
Originally posted by: notfred
Originally posted by: gopunk
Originally posted by: notfred
Originally posted by: gopunk
like i posed earlier, do you refuse to shop in stores with security cameras? do you refuse to buy cd's with antitheft devices on them? what about clothes?
If everytime I bought a pair of pants, I had to pay for them, take them home, then call the store back and ask "Can I wear my pants now?" and hope they said yes, and then if I wanted to wear my pants with a different shirt, call them backand say "I changed my shirt, can I get permission to wear my pants with the new shirt?" No, I would not buy pants from that retailer.
you missed the point. he was ranting about how he was being treated like a criminal. you are being treated like a criminal in the examples i gave. yet people don't mind that.
btw the reason why your example is so ricockulous is because unlike software, clothing can only be used by one person at one time.
You missed my point. My point was that software activation is a pain in the ass. My example is perfectly fine from a practical standpoint, and I didn't mean for it to apply in the reasoning for the licensing, just the annoying act of registering your product.
Originally posted by: manly
You guys are both retards for this particular opinion (gopunk was probably being facetious but who cares). First off, UNIX has been around for ages and has excelled in the workstation and server markets for many years. People use it because it works, and often works better than Windows. Windows established solid (not perfect) stability just two years ago and everybody is supposed to switch to it because you feel it's faster and more efficient? People are different; it's completely brain-dead for you to say everyone would benefit most from using Windows, but instead Linux geeks just want to be different.Originally posted by: gopunk
I agree that for some applications windows isn't up to par, but it still seems the *nix crowd is an elitist bunch who is using it for the sake of being different and anti-MS, even though what they are doing is already being done by windows in a faster and more efficient manner.
mm... yea, linux peopleunix people are cool... (and use it out of necessity)
Why do you use windows?
Originally posted by: rojkai
because i cant build a mac for less than $1000 and i believe anybody who likes UNIX for the purpose of being able to type in commands is simply out of their minds..computers are supposed to make our lives easier, no ?