I'd like to delete two lines in a file, containing pattern aaa bbb ccc.  I have used the following expression, which deletes the line containing pattern aaa bbb ccc and the line before.  $ sed -n '/aaa bbb ccc/{s/.*//;x;d;};x;p;${x;p;}' file.txt | sed '/^$/d'   This works for one file. It doesn't work for multiple files  $ for i in *.txt; do sed -n '/aaa bbb ccc/{s/.*//;x;d;};x;p;${x;p;}' "$i" | sed '/^$/d'; done   example file:  xxx yyy aaa bbb ccc eee fff aaa bbb ccc ggg hhh   result file:  xxx eee ggg hhh
I have the following code that will remove lines with the pattern banana and 2 lines after it:  sed '/banana/I,+2 d' file   So far, so good! But I need it to remove 2 lines before banana, but I can't get it with a “minus sign” or whatever (similar to what grep -v -B2 banana file should do but doesn't):  teresaejunior@localhost ~ &gt; LC_ALL=C sed '-2,/banana/I d' file sed: invalid option -- '2' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,-2 d' file sed: -e expression #1, char 16: unexpected `,' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,2- d' file sed: -e expression #1, char 17: unknown command: `-'
Proof that $n\Bbb Z \leq \Bbb Z$ and are the only subgroups of $\Bbb Z$ My challenge is      Prove that if $n = 0,1,2,\ldots$ and $n\Bbb Z = \lbrace nk: k \in \Bbb Z \rbrace$, show that $n\Bbb Z$ is a subgroup of $\Bbb Z$ and are the only subgroups.   I handled the first point by saying that  i) Identity is 0, and $0\in n\Bbb Z$ and $0 \in \Bbb Z$  ii) For any $a,b \in n\Bbb Z$ $a+b = na_2 + nb_2 = n(a_2+b_2) \in n \Bbb Z$  iii) For any $na \in n\Bbb Z$, its inverse $n(-a) \in n\Bbb Z$.  For the second point, I said that all of the subgroups should be infinite, because for any finite group the largest element $a+a \notin H$, where $H$ is the potential subgroup, which is a contradiction. So $H$ must be of infinite order. For any $a \in H, -a$ should also be in $H$. The difference between any $a,b \in H$ should also be in $H$, i.e. $(a-b) \in H$. This leaves only the whole group or any group of the form $n\Bbb Z$.  Is my proof complete? What is your favorite method to handle errors in Bash?  The best example of handling errors I have found on the web was written by William Shotts, Jr at .   He suggests using the following function for error handling in Bash:  #!/bin/bash  # A slicker error handling routine  # I put a variable in my scripts named PROGNAME which # holds the name of the program being run.  You can get this # value from the first item on the command line ($0).  # Reference: This was copied from &lt;http://www.linuxcommand.org/wss0150.php&gt;  PROGNAME=$(basename $0)  function error_exit {  #   ---------------------------------------------------------------- #   Function for exit due to fatal program error #       Accepts 1 argument: #           string containing descriptive error message #   ----------------------------------------------------------------       echo "${PROGNAME}: ${1:-"Unknown Error"}" 1&gt;&amp;2     exit 1 }  # Example call of the error_exit function.  Note the inclusion # of the LINENO environment variable.  It contains the current # line number.  echo "Example of error with line number and message" error_exit "$LINENO: An error has occurred."   Do you have a better error handling routine that you use in Bash scripts? How can metagaming retries on poor skill checks be prevented? I'm sure every DM has had this happen: one PC is trying to find something cool on a dead monster's body. The player rolls poorly, and instead of accepting the paltry 2 copper pieces, the PC calls all the party members over to also try looting the corpse. Invariably, a different player rolls well, and everyone walks away satisfied that everything's been taken down to the poor dead monster's last holey sock.   Another example: One PC is trying to find some useful information in a library. There're no guards, no reason anyone would be bothered, and no time restraints to stress about. The player rolls poorly, so all the other PCs try, too.  I'd describe this as well-intentioned metagaming. The players are afraid of losing out on content, this despite multiple sessions of me making it clear that I don't structure my games to penalize gameplay that way.  These are situations that require a roll to determine the degree of success. (At least I think so; perhaps I'm wrong here?) Failure could set back the PCs a cool item or a bit of information that would have helped a little, but these minor failures aren't game-enders or anything. As a DM I can't see a reason to say "No" and disallow the practice, but it feels vaguely like cheating to let the players roll multiple times to get better results.  How do I prevent players ganging up on skill checks after they've seen someone roll poorly? I changed my username and now I cannot play online Simple question.   SO had turned me into a better developer by far, I like to browse questions that strike my interest and curiosity and just read through the answers. I never fail to learn something new everyday, whether it's something trivial or something much more complex.  When I receive reputation it means a lot to me, almost a self achievement of sorts. Something I can show to someone to prove my "worth". I think it works for me as a great confidence booster, also its something I can show my friends who don't understand what I do.   It almost feels like I can finally have something to back me up if need to be.  So the question is what does YOUR reputation mean to YOU? Is it simply a number, is it a score as if you're playing a game, or does it help you mentally achieve your goals and improve yourself like it does for me. Does a (half) beheaded Ettin take bleeding damage of some sort? Let's say a character cuts off one of an Ettin's heads, but the other head is still intact, and it's as such still alive. Obviously, there's a lot of blood. Does the Ettin take continuous damage from naturally bleeding out? Or does it not work that way? How to find Hamiltonian from this simple Lagrangian? (tricky) $$L~=~ \frac{1}{2} \dot{q}  \sin^2{q} $$  Is it zero or not defined? I realize that an image histogram is a graphical display of an images tonal distribution (i.e. horizontal darks to lights, vertical pixel distribution), but how does one really use it and why? I mean, can't you determine everything you need just by looking at the image? Problems with macOS path on Synology NAS (SMB) I am having issues with macOS where, after mounting a drive it will mount new drives instead of just jumping to the sub-folder path within the mounted drive.   For example, I'm seeing where I send someone a path for in the "Video" drive on a Synology (smb://HAL9000/Video).  Instead of mounting the "Video" drive (smb://HAL9000/Video) and going to a sub-folder within the video drive labeled "GoPro -IMPORT", it will create a new drive on their desktop labeled "GoPro - IMPORT".    If I create a new sub-folder within "GoPro - IMPORT" and send them a link to that like (smb://HAL9000/Video/GoPro%20-%20IMPORT/Test), instead of taking to the sub-folder in the "Video" drive that they already have mounted on their desktop, it will create an entirely new drive labeled "Test" on their desktop.    I've tried reaching out to both Apple and Synology and had no luck with this.  I would appreciate any kind of help/support. Is there a way to insert Keyboard Glyphs in Google Docs? Here on the StackExchange framework we have a nice feature, which is apparently called "Keyboard Glyphs" (cf. ):     CTRL+Z   Is there a way (e.g. with an Add-On) to do the same in Google Docs? I browsed the Add-Ons but did not find anything, maybe it's hidden somewhere different (e.g. in a Code Formatting Plugin). Getting filesystem path of class being executed How to put a '+' sign inside a square like xor How to handle a deliberate duplicate question I got  question in review. First sentence is:     I know there is a  question, but no answers.   And indeed the two questions are virtually identical. I started to flag as duplicate - but the original question had no answer at the time, so it wouldn't be correct and apparently . (I didn't go so far as to try to submit the flag).  What is the proper action here? How do we want such a question to be handled? Should both (or more) questions stay open indefinitely until either is answered and somebody gets the good idea to do the duplicate linking?   As the new question is essentially a bump to the front page (perhaps with re-tagging), especially in the case where the OP knows that a previous question exist, perhaps something should be done to enable bumping re-emphasizing without writing the new question.  As I wrote this,  actually got an answer. So the old one should now be closed as a duplicate of the new - but my question remains for the case where all known/found duplicate questions have no answer?  Ironically, just before asking this, the "Questions that may already have your answer" gave me ... (Although the suggestion has no answer). So it has been asked before - the comment there even suggest the ability to re-emphasize. What are the survival limitations of alcohol? This question was inspired by watching one of the Pirates of the Caribbean movies; particularly where Jack Sparrow allegedly survives on a desert island by finding an unlimited supply of rum. I've heard alcoholic drinks dehydrate you more than hydrate you, so this seems like an unsustainable strategy.  My question is threefold.    How long can a human survive by drinking hard liquor (40% alcohol by volume) for their sole water intake (ignoring food)? If it's unsustainable, what will finally take you down? If the hard-liquor approach isn't viable, what % alcohol can keep you hydrated (beer, wine, etc.)?   Related: 1.  2. Cylindrical vs azimuthal symmetry For every set $A$, the empty set is a subset of $A$. The empty set is a set. Therefore, the empty set has a cardinality $\geq 1\ldots$ I have only recently been exposed to sets. According to , as seen on the first bullet mark of the link, $ \forall A: \emptyset \subseteq A$  Does this mean that $\emptyset$ is an element of all sets? (This is False, thank you those that answered)  Is the empty set also a set itself?  Assuming these statements are true, then the empty set therefore an element of the empty set. This does not sound right, please clarify for me. Thank you. "As a beginner, I am happy that I learned a new thing."  You will recognize this as your DoReMi-s.( at 4:52)  What is the meaning of the "AS" there and when do we use that?  In depth answers would be appreciated.  Similarly:     Do I have your word as a lawman not to shoot me down like a dog in the street?    Can you explain this sentence?   Can I understand it as a lawman wouldn't shoot down people on the street or wouldn't have his word or what? I am preparing a paper in the field of Computer Science.  In order to report test results, we usually run a number of tests and report the average of those tests.  For each test, we generate random data.  Because of the randomness, at some points, the results may come out not as expected.  For instance, a graph may be like:   Usually, one should explain why on points 8, 11 and 12 there is a decrease on the plot. Probably, it is because of that randomness.  Not hand-crafting all the graph, but just manipulating a few points makes the graph acceptable:   Since three weeks or so, I work my ass off and try to figure out why my resulting graph looks like the first one. Sometimes I feel like yielding to temptation and just modify the raw data before I go crazy.  I believe, at this point the title became misleading, so let me make it clear:  I am not seeking an advice on data manipulation. I will not manipulate my data. However, I ask to myself "how the hell this can be detected?"  And now, I don't only ask to myself, but to whole community. How is this detected? For editors, referees out there, have you ever detected something like this? What are the barriers to understanding pointers and what can be done to overcome them? Why are pointers such a leading factor of confusion for many new, and even old, college level students in C or C++?  Are there any tools or thought processes that helped you understand how pointers work at the variable, function, and beyond level?  What are some good practice things that can be done to bring somebody to the level of, "Ah-hah, I got it," without getting them bogged down in the overall concept? Basically, drill like scenarios. Are user accounts on data.stackexchange.com and Stack Exchange two different entities? I tried to search for similar questions, as I always do, but was not able to find one. I just created a new  on Data.Stack Exchange with my existing Google OpenID and it seems to be not associated with my regular Stack Exchange account. Is this by design? and if so, why?