Appending word at the end of line with sed I have a code block as follows in a file:  BalancerMember http://snode1:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode1 BalancerMember http://snode2:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode2   I want to search for all lines which had tc_ keyword and add status=D at the end of those lines. So, the above entries will become like this  BalancerMember http://snode1:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode1 status=D BalancerMember http://snode2:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode2 status=D   I am using the following command to achieve this:  sed -i '/tc_/a status=D' app.conf   But I can see status=D is being after a newline. I don't want a newline for this. It should be appended with a '' (space) .
How to add text to end of line when pattern is matched? inputs:  line1 with the PATTERN that contains ( )  line2 with the PATTERN that contains ( )  lineN with the PATTERN that contains ( )    outputs:  line1 with the PATTERN that contains ( ) ; line2 with the PATTERN that contains ( ) ; ... lineN with the PATTERN that contains ( ) ;   I tried this:  find . -name "test.txt" -print | xargs sed -i "/PATTERN/ s/$)/); /g"   but it didn't work.
Prove that $\sum^{n}_{r=0}(-1)^r\cdot \large\frac{\binom{n}{r}}{\binom{r+3}{r}} = \frac{3!}{2(n+3)}$ Is there an upper limit to temperature in thermodynamics or statistical mechanics In many presentations of statistical mechanics where we have a system of particles having mass, such as the molecules of an ideal gas, the temperature is often equated to the average relative velocity of the particles. However no such velocity can exceed that of light. Is there therefore an absolute upper bound to temperature as well as an absolute zero? What does the volatile keyword do? In C++ what problem does it solve?  In my case, I have never knowingly needed it. Using the variable "name" doesn't work with a JS object Why does Benford's Law (or Zipf's Law) hold? Both  (if you take a list of values, the distribution of the most significant digit is rougly proportional to the logarithm of the digit) and  (given a corpus of natural language utterances, the frequency of any word is roughly inversely proportional to its rank in the frequency table) are not theorems in a mathematical sense, but they work quite good in the real life.   Does anyone have an idea why this happens?  (see also ) Trigger for avoid insertion from data loader? i have scenario like write a trigger avoid insertion of records  from  data loader,only manual insertion trigger will fire?on any object     while Entering records from data loader trigger should not fire? Proving by induction $4^n  0$ After upgrading to Ubuntu 17.10, Ubuntu Dock icons of some of my apps are not appearing. They appear properly in the dash. I verified the *.desktop files for the applications in /usr/share/applications and ~/.local/share/applications.  E.g. dock icon is not displaying for "Terminator". Check out the attached image.    This is how the icon for the same application appears in dash search:    Content of /usr/share/applications/terminator.desktop:  [Desktop Entry] Name=Terminator Comment=Multiple terminals in one window TryExec=terminator Exec=terminator Icon=terminator Type=Application Categories=GNOME;GTK;Utility;TerminalEmulator;System; StartupNotify=true X-Ubuntu-Gettext-Domain=terminator X-Ayatana-Desktop-Shortcuts=NewWindow; Keywords=terminal;shell;prompt;command;commandline; [NewWindow Shortcut Group] Name=Open a New Window Exec=terminator TargetEnvironment=Unity   Any pointers to debug this issue will be helpful. How can I detect the encoding/codepage of a text file In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage.  Is there a way to (automatically) detect the codepage of a text file?   The detectEncodingFromByteOrderMarks, on the StreamReader constructor, works for UTF8  and other unicode marked files, but I'm looking for a way to detect code pages, like ibm850, windows1252.     Thanks for your answers, this is what I've done.  The files we receive are from end-users, they do not have a clue about codepages. The receivers are also end-users, by now this is what they know about codepages: Codepages exist, and are annoying.  Solution:    Open the received file in Notepad, look at a garbled piece of text. If somebody is called François or something, with your human intelligence you can guess this. I've created a small app that the user can use to open the file with, and enter a text that user knows it will appear in the file, when the correct codepage is used.  Loop through all codepages, and display the ones that give a solution with the user provided text.  If more as one codepage pops up, ask the user to specify more text. I want to find the interval of convergence of $$\sum_{n=0}^\infty (\frac{n}{n+1})^{n^2}(2x)^n$$ By the root test, $\sqrt[n]{|(\frac{n}{n+1})^{n^2}(2x)^n|}=|(\frac{n}{n+1})^{n}(2x)|$  And $(\frac{n}{n+1})^n=(1-\frac{1}{n+1})^n\to\frac1e$ as $n\to\infty$  So I've got an open interval(of convergence) s.t. $|\frac1e 2x|&lt;1\implies |x|&lt;\frac e2$.  Now I need to figure out whether the series is convergent or not at the end points, $x=\frac e2, -\frac e2$.  So there are two series I need to deal with, namely, $\sum_{n=0}^\infty (\frac{n}{n+1})^{n^2}e^n$ and $\sum_{n=0}^\infty (\frac{n}{n+1})^{n^2}(-1)^ne^n$.  Suppose $(\frac{n}{n+1})^{n^2}$ is increasing. Then $$(\frac{n}{n+1})^{n^2}&lt;(\frac{n+1}{n+2})^{(n+1)^2}\iff 1&lt;(\frac{n+1}{n+2})^{(n+1)^2}(\frac{n+1}{n})^{n^2}$$ $$\iff 1&lt;(1-\frac{1}{n+2})^{2n+1}(1+\frac{1}{n^2+2n})^{n^2}$$  But $(1-\frac{1}{n+2})^{2n+1}\to\frac{1}{e^2}$ and $(1+\frac{1}{n^2+2n})^{n^2}&lt;(1+\frac{1}{n^2})^{n^2}\to e$  So I have $1&lt;\frac1e&lt;1$, which is a contradiction. Hence $(\frac{n}{n+1})^{n^2}$ is not increasing. But I don't know if it's decreasing. (is it true that $(1+\frac{1}{n^2+2n})^{n^2}\to e$?)  If $(1+\frac{1}{n^2+2n})^{n^2}\to e$ is true, then $(\frac{n}{n+1})^{n^2}e^n$ converges to some positive number, so $\sum(\frac{n}{n+1})^{n^2}e^n$ diverges. But I don't know if it's decreasing: can't apply the alternating series convergence test(Leibniz's criterion).  So, can you help me with the two end points? How do I migrate my Keychain's "Local Items" to a new Mac? After preforming a Mavericks-Mavericks migration using Migration Assistant, I have a "Local Items" Keychain on my new machine in which many (perhaps most) items are out of date (using old passwords), and some are missing altogether. While I have access to a copy of the entire contents of the ~/Library/Keychains/ directory from my old machine, which presumably contains all the information I'm missing, I see no way of importing that information into my new machine.  How can I import the "Local Items" from my old Keychain into the Keychain on my new machine? Product rule intuition Can anyone think of an intuitive explanation of the product rule? I'm not asking for a derivation. To me it seems like quite an un-untuitive result, as apposed to the chain-rule (which is ironically harder to derive). So this has puzzled me for many a year... I still am no closer to coming to a conclusion, after many arguments that is. I don't think it can, others 100% think it will.   If you have a plane trying to take off whilst on a tread mill which will run at the same speed as whatever the planes tires rotation speed is will it take off?  [edited to be more clear]  The question is simple. Will a plane take off if you put this plane onto a treadmill that will match whatever speed the plane wheels are moving at. So the plane should not be able to move.  This is a hypothetical situation of course. But I am very interested. how to make some border lines of a table thick and colored how to make some border lines of a table thick and colored (either vertical lines or horizental lines)?I tried Xcline but could not color it. Also I tried make the cline thick but failed. Possible Duplicate:          I'm working on a website that displays distance to various locations to the nearest 1/10 mile. One of the developers (a non-native speaker) asked me an interesting question: If the distance is 1.0 mile(s), is that singular or plural? Clearly, anything other that 1.0 is plural, but is it:     1.0 miles away   or     1.0 mile away   The first option sounds more correct to my ear, but the voice of my elementary school language arts tells me that the latter option is correct.  Edit: Added the word 'away' to the example. It doesn't change the question, but might provide clarity for the answer. Also, regarding numbers between 0 and 1, after more thought, I'm not sure that the answer is as clear as I originally thought. See . Showing that $\sum_{i=1}^n \frac{1}{i} \geq \log{n}$ I have been trying to prove this by induction on $n\in \mathbb{N}$, but this approach seemed to get me nowhere. I have a suspicion it might be necessary to express $\log{n}$ as $\int_1^n 1/x\text{ }dx$, but I could not build a rigorous argument from that.  Any help greatly appreciated! EDIT: Summary  I think I've found the best definition of what I want thanks to the discussion with @M. Tibbits:  When I open or refresh the SO, I get a notification of new activities that are of interest to me. Today these are (hard-coded): answers to my questions and comments addressed to me. I want a bit more control over it, that's all.     Yes, I've read  and , but I think I add new (good :) ) reasons for re-asking it:  The first question was answered before this so handy "inbox" notification feature was implemented. So now using favorites for "watching" a question is wrong, IMHO, for 2 reasons:   it splits essentially the same functionality (of getting notified when there is an activity you are interested in) between 2 very different user interfaces it's cumbersome - I need to: 1) add question to favorites; 2) click on my profile dropdown; 3) click on the "favorites" line; 4) see all my favorites with recent activity; 5) select the one I watch; 6) repeat this process occasionally to get updates; and 7) possibly remove the question from favorites at the end. All this as opposed to this little red button when there are news.   Favorites are different in nature that watching. I add a question to Favorites when I find the answers useful to me in my work, so I may want to have it handy in the future. By watching an interesting question I will be able to decide whether I want it in faviorites, after I see the answers.  EDIT: I see that I was not clear enough.  I want to add a question to Favorites when:   it has some good answers the question and answers are relevant in my work I want to keep them handy as my long-term (persistent) knowledge base   I want to watch a question for short while (matter of days/weeks) when:   it is interesting / relevant I want to follow it to see what are the answers. Then I can decide whether I want it in my favorites   As you see, the main differentiators are good answers and long/short term. For short-term, automatic notification is better.  Bottom line, all I ask is "watch this question" checkbox (which may expire after say a week if there is a need to free resources) Deleting comments and review actions cause layout to be broken, AJAX response contains full page Prove that $|f''(\xi)|\geqslant\frac{4|f(a)-f(b)|}{(b-a)^2}$ What is the most secure hand cipher? By "hand cipher", I mean a symmetric cipher for which encryption and decryption can can both be performed with a pencil on graph paper, consuming about 10-20 seconds per character by a proficient user. Additional simple tools, e.g. a deck of cards or a multiplication table, may be used to expedite the process. No mathematical proficiency is required other than mental addition, subtraction, and maybe multiplication.  Basically, it should be a cipher that someone of average mathematical abilities can master, and it should require no digital technology or cryptographic tools that cannot be constructed out of paper.  For example, four-square in CBC mode seems secure to me because CBC is a well established mode of operation and four-square seems to be a good block cipher as it accommodates large keys and seems to produce a random-looking output. However, the fact that four-square in CBC was never widely adopted before digital encryption became a consumer technology leads me to believe that someone broke the cipher and thus discouraged people from using it.  So is there any hand cipher that the best supercomputers would take years to cryptanalyze? If not, then for which hand cipher is the best known attack the most complex?