<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Rant follows. If you're not up for some immaturity on a Sunday morning, it's OK, please press delete. Before that, once again, please accept my appreciation for the tons of help you guys are giving me. I trust some of you will relate.<br></div>
<div> </div>
<div>Jim, who is always here, always helpful, asked me some good questions about my one-liner,<br></div>
<div> </div>
<div><span class="highlight" style="background-color: rgb(255, 255, 255)"><span class="colour" style="color:rgb(31, 31, 31)">sed -i.bak 's:(^Defaults\s*Env_reset\s*)$:$1\nDefaults editor=/bin/nano:' ./sudoers</span></span><br></div>
<div> </div>
<div><span class="highlight" style="background-color: rgb(255, 255, 255)"><span class="colour" style="color:rgb(31, 31, 31)">, one of which was w</span></span>hy "$1?"<br></div>
<div> </div>
<div>For the "replace" portion of sed, I was trying to find out how to return the result of the last search and $1 seemed to be the right way to do it. I saw what I thought was a authoritative page on this but cannot find it now. One that I did find is <a href="http://stackoverflow.com/questions/2890700/backreferences-syntax-in-replacement-strings-why-dollar-sign">http://stackoverflow.com/questions/2890700/backreferences-syntax-in-replacement-strings-why-dollar-sign</a> .<br></div>
<div> </div>
<div>Everything I'm readying about regular expressions talks about this engine does it this way and that engine does it that way and it's all very confusing and frustrating. None of the "engines" are fedora-based bash, so I have no idea which engine's requirements I'm supposed to go by.<br></div>
<div> </div>
<div>On top of this I have to struggle with a problem endemic to technical writing and which is far too common: writers who state a rule and then give examples inconsistent with the rule just described!<br></div>
<div> </div>
<div>This makes me scream. I've seen it in so-called textbooks and well-regarded non text-books on mathematics such as 1089 and All That. It usually results in uncharitable thoughts about the author followed by some profanity and an addition to the trash can. On grymoire.com, for example, Bruce Barnett writes, "If you need to match a "^" at the beginning of the line, or a "$" at the end of a line, you must escape the special character with a backslash." Hard rule, got it, I'm good, let's read on...and then he follows it up with THESE examples!:<br></div>
<div> </div>
<div>^A matches "A" at the beginning of a line<br></div>
<div>A$ matches "A" at the end of a line<br></div>
<div>A^ matches "A^" anywhere on a line<br></div>
<div>$A matches "$A" anywhere on a line<br></div>
<div>^^ matches "^" at the beginning of a line<br></div>
<div>$$ matches "$" at the end of a line<br></div>
<div> </div>
<div>WT#! It maybe would've killed him to mention escaping the character OR doubling it, and then give BOTH examples?:<br></div>
<div> </div>
<div>^^ or \^ matches "^" at the beginning of a line<br></div>
<div>$$ or \$ matches "$" at the end of a line<br></div>
<div> </div>
<div>How are we supposed to learn anything if we can't trust our teachers!<br></div>
<div> </div>
<div>I'm almost 60. I approach this stuff in good faith, with no math training beyond high school, no programming experience beyond Excel, a little BASIC as a teenager* in the 70's, and an introduction to Visual Basic course at DeVry in 2003 (where I got high marks for both coding and commenting), and every time I try to learn something I run into walls because the teachers won't do in English what they do in code!<br></div>
<div> </div>
<div>Anyway, thank you for listening. I'm not going to give up this time.<br></div>
<div> </div>
<div> </div>
<div> </div>
<div>Steve</div>
<div> </div>
<div>*This was the first time I gave up on trying to learn something by reading the documentation. The page in my TRS-80 manual said something like print(string) and absolutely NOWHERE in the book was there the least little hint that the correct syntax was print("string"). I struggled with it for days, believing those people, before finally giving up. To my credit, I did not blame myself.<br></div>
<div> </div>
<div> </div>
</body>
</html>