I want to check the difference of two file list   one is ls | cut -c 1-4 another is ls | cut -c 1-4 | uniq  does there exists any way can let me do like this diff (ls | cut -c 1-4) (ls | cut -c 1-4 | uniq) or anyway can let me without saving the two list command into files then check the difference of it ..  thanks
I'm trying to compute the difference between the output of two awk commands but my simple attempts at it seem to be failing. Here is what I'm trying:  diff $(awk '{print $3}' f1.txt | sort -u) $(awk '{print $2}' f2.txt | sort -u)   This doesn't work for reasons unknown to me. I was under the assumption that $() construct was used to capture the output of another command but my "diff" invocation fails to recognize the two inputs given to it. Is there any way I can make this work.  By the way, I can't use the obvious solution of writing the output of those two commands to separate files given that I'm logged on to a production box with no 'write' privileges.
update-java-alternatives vs update-alternatives --config java On Ubuntu 12.04 LTS I have installed Sun's JDK7, Eclipse, and the Arduino IDE. I want the Arduino to use OpenJDK 6 and want Eclipse to use Sun's JDK 7.   From my understanding I need to manually choose which Java to use before running each application. This led me to the update-java-alternatives -l command. When I run this I only see the following:   java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64   but when I run update-alternatives --config java I see the following:   *0  /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   auto mode 1  /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   manual mode 2  /usr/lib/jvm/jdk1.7.0/bin/java                   manual mode 3  /usr/lib/jvm/jre1.7.0/bin/java                   manual mode   I don't understand why the update-java-alternatives doesn't display the same 3 options. I also don't understand how to switch between OpenJDK6 and JDK7. How I can go about using the OpenJDK6 for Arduino development and Sun JDK7 for Eclipse/Android development? Singular vs. Plural with Multiple Gerunds as Subject (IE: [Gerund] and [Gerund] are/is [something].) I'm trying to find out whether I should use a singular or plural verb when there are multiple gerunds as the subject of the sentence. For example:  Running the correct course and keeping a steady pace are/is necessary in order to win.  With either one of these by itself, &quot;is&quot; would be correct:  Running the correct course is necessary in order to win. Keeping a steady pace is necessary in  order to win.  With both gerunds combined, I can't seem to figure out whether the verb should stay singular since each phrase is singular, or if it should become plural since there are two connected by &quot;and&quot;. If we just treat the gerunds as regular nouns, then obviously it would become &quot;are&quot;, but I'm not sure if gerunds have the exact same rules as regular nouns. I know that if the sentence was:  Running the correct course and keeping a steady pace are both necessary.  That &quot;are&quot; would be correct, but without the &quot;both&quot; it sounds incorrect to me. Does anyone know the official rule here? Chaining the Imperius curse What would happen if a wizard w successfully casts the Imperius curse on a equally powerful wizard a and then order him to cast the same curse back on w?  Follow-up questions.  It is established that casting the curse can be done .  What would happen in the case of a chain of casts that would hit back the original wizard? w-&gt;a-&gt;b-&gt;c-&gt;w  The original wizard could rather command the last wizard c, in the chain, to curse his first target instead. w-&gt;a-&gt;b-&gt;c-&gt;a wich would create a loop of a-&gt;b-&gt;c-&gt;a...  In what kind of limbo would wizards a, b and c exist in?  ( for the sake of simplicity, we can assume that every curse target is not very good at resisting the curse ) Why does this excerpt say that unbiased estimation of standard deviation usually isn't relevant? Can I publish a feed of my Meetups to appear on my Google Calendar? I'm a bit of a Meetup junkie so I'd like to automate the appearance of any Meetup I RSVP to automagically appear on my Google Calendar. Intuitive explanation of unit root How would you explain intuitively what is a unit root, in the context of the unit root test?   I'm thinking in ways of explaining much like I've founded in .  The case with unit root is that I know (little, by the way) that the unit root test is used to test for stationarity in a time series, but it's just it.   How would you go to explain it to the layperson, or to a person who has studied a very basic probability and statistics course?  UPDATE  I accepted whuber's answer as it is what most reflect what I asked here. But I urge everybody that came here to read Patrick's and Michael's answers also, as they are the natural "next step" in understanding the Unit Root. They use mathematics, but in a very intuitive way. Let $f$ be a holomorphic function defined on $\Bbb C$ such that $f^{-1}(\Bbb R)=\Bbb R$. Prove that there exists $a,b \in \Bbb R, \; a \neq 0 \;$ such that $f(z)=az+b \;$ for every $z \in \Bbb C$.  I was given a hint: define the function $g(z)=\frac{f(z)-f(0)}{z}$. such $g$ is also holomorphic in $\Bbb C$ since the only singularity is in $0$, and it is a removable singularity since we can define $g(0)=f'(0)$. Next I thought about proving $g$ is bounded, and thus constant (using Liouville's theorem), but pretty much out of ideas. How can I finish the proof/solve in another way? Is there a way to input particular sections of source code using \lstinputlisting (from the listings package) in a flexible way?  It's possible to use the firstline and lastline options to input particular line ranges, but this isn't robust to changes to the source file.  For example, suppose that the input source file is:  int square(int x) {   return x * x; }  int cube(int x) {   return x * x * x; }   In my LaTeX document, I can include the cube procedure using the command \lstinputlisting[firstline=5,lastline=7]{source.c}.  But suppose I later decide to rewrite the cube procedure.  The input source file becomes:  int square(int x) {   return x * x; }  int cube(int x) {   int x2;   x2 = square(x);   return x * x2; }   Now my LaTeX document will not show the final two lines of cube because the listing uses only lines 5-7.  I could manually update the line range, but this is tedious and error-prone.  Is there a way to mark sections of source code with some kind of label so that the listing will be robust to these sorts of changes?  For instance, perhaps the input source file would be something like  int square(int x) {   return x * x; }  /**\beginlabel{lst:cube} **/ int cube(int x) {   int x2;   x2 = square(x);   return x * x2; } /**\endlabel{lst:cube} **/   so that I could use something like \lstinputlisting[lines=lst:cube]{source.c} to include the section that I want and remain robust to changes.  I am open to using other packages for source code listings (e.g., minted) if helpful. How to install X11/xorg? My 12.04 x64 system won't boot into GUI, but I can still use virtual console with my own account, so apparently it's the Windows Management System that's causing it, how can I reinstall it from tty, what's the apt-get command? My GNU/Linux system (Arch) now has libncurses.so.6 rather than libncurses.so.5. But I have upstream's vanilla TeX Live (fully updated) and xindy wants libncurses.so.5:    xindy --version   produces the following error  xindy release: 2.5.1 xindy script version: 1.18 /usr/local/texlive/bin/xindy.run: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory   And ldd can confirm the problem:  ldd /usr/local/texlive/bin/xindy.run    gives      linux-vdso.so.1 (0x00007ffc07997000)     libm.so.6 =&gt; /usr/lib/libm.so.6 (0x00007fab4d1b1000)     libcrypt.so.1 =&gt; /usr/lib/libcrypt.so.1 (0x00007fab4cf79000)     libncurses.so.5 =&gt; not found     libdl.so.2 =&gt; /usr/lib/libdl.so.2 (0x00007fab4cd75000)     libc.so.6 =&gt; /usr/lib/libc.so.6 (0x00007fab4c9d1000)     /lib64/ld-linux-x86-64.so.2 (0x00007fab4d4af000)   How can I use xindy without changing my operating system, while using vanilla TeX Live?  2 strategies have occurred to me:   compile xindy from sources against libncurses.so.6; compile and install libncurses.so.5 alongside libncurses.so.6.   Option (2) can be dodgy or can be fine, depending on the details. My suspicion is it may be dodgy for this library, simply because no packages are available for the old version of the library, which might mean there are problems having both installed. Moreover, since everything else is compiled against the new version, I'm not sure whether this would be enough for xindy anyway.  Option (1) I have no idea about. I don't know if this is even vaguely doable or, in fact, where the sources are or what might be required to compile them. (I don't suppose there's any chance a pre-compiled binary is available somewhere? But that is probably hoping for too much ;).)  What is the most practicable approach? have already been created through .  have already completed their beta stage and are waiting for launch.  are in public beta stage.  are in commitment phase in   proposals are listed in   Now it is really confusing to find a suitable site to ask a question. As an example - I host a blog using . Now I have a question about this hosting. I want to post it in a . Where will I post? I have 2 options available now.     Are developers trying anything to solve this confusing matter? Is this mold? Black? White? Guys I need to find out what this is- it's also on my wooden bed racks When I installed the latest update of Ubuntu, I was asked for the username but I do not remember what my username is. How do I find out what my username is? How to find the limit of a sequence? Question:  If $0 &lt; x &lt; \frac{\pi}{2}$ and $f_k(x) = \tan(x)+\frac{1}{2}\tan(x/2)+ ...+\frac{1}{2^k}\tan(x/2^k)$.  In Sigma Notation: $$f_k(x) = \sum_{n=0}^k \frac{1}{2^n}\tan\frac{x}{2^n}$$  Find $$\lim_{k\to \infty}f_k(x)$$  I'm not quite sure how to take the limit of a sequence, I've never seen this before, If someone could help me solve this it would be greatly appreciated. This is an exercise from my calculus class. The function is defined as $x\sin (1/y)+y\sin (1/x)$ if $x\neq0 $ and $y\neq0 $, and $0$ if $x=0 $ or $y=0$.  I'm pretty confident the limit exists and should be $0$, because: $$\lim_{(x,y)\to(0,0)}[x\sin (1/y)+y\sin (1/x)]=\lim_{(x,y)\to(0,0)}[x\sin (1/y)]+\lim_{(x,y)\to(0,0)}[y\sin (1/x)]$$  And: $x\leq x\sin(1/y)\leq x$, so $\lim_{(x,y)\to(0,0)}[x\sin (1/y)]=0$ right? (The same can be said for $\lim_{(x,y)\to(0,0)}[y\sin (1/x)]$)  However, I tried checking my answer, and according to Wolfram Alpha the limit doesn't exist. Is this because I'm wrong, or is it just because $x\sin (1/y)+y\sin (1/x)$ is undefined for $y\neq0 $ and $y\neq0 $ Should I use UUID as well as ID How to check if a string contains a substring in Bash I have a string in Bash: string=&quot;My string&quot;  How can I test if it contains another string? if [ $string ?? 'foo' ]; then   echo &quot;It's there!&quot; fi  Where ?? is my unknown operator. Do I use echo and grep? if echo &quot;$string&quot; | grep 'foo'; then   echo &quot;It's there!&quot; fi  That looks a bit clumsy. A method for the OP to accept comments? Question: What if the author of a question can accept a comment?   The problem:  Time and time again, answers are posted as a comment.  Usually, the person who commented has the best of intention (e.g. it was a trivial answer [to the answerer], and they weren't sure if the OP would immediately edit the question after the comment).  But this leaves the frustrating situation of an unanswered question with a perfectly good answer.  This problem accumulates over the years.     Candidate solution:  The OP can just "accept" the comment, after which a duplicate of the comment is made an accepted CW answer, with a preface indicating that it was originally a comment, e.g. This answer was originally a comment posted by [[blah]] that has been accepted by the author of the question.   Comments on this scheme:   The author of the comment has indicated they're not interested in gaining/losing reputation through their comment (thus CW answer). The original comment is still there. If desirable, the "author" of the accepted question could be a "bot", so the answer is not attributed to a genuine account.  (I suppose it would already be technically possible for Joe Blow to create a script for a bot that creates an answer from a comment in the proposed way.)     A similar question was asked before  (over 3 years ago), and in numerous other questions which have been deemed "duplicates" (,  and ; see also ), so there seems to be demand for such a feature.  The answers to these questions seem (to me, at least) quite weak:   "ask the commenter to add the comment as an answer"   The OP already did this by asking the question in the first place.  And what if the author of the comment doesn't respond (or takes a long time to respond)?  This also adds more chit-chat irrelevant to the question.   "add an answer of your own, referring to the comment, and accept it."   A hacky workaround.  How could this possibly be better than accepting a comment?  (Yet, this is the most up-voted response.)  Moreover, this adds to the user's list of "answers" (thus making the user's page harder to look through).   "When i leave a comment, i do so because i want to leave a comment."   Great; now what about everyone else?  In the immortal words of the FAQ: "Other people can edit my posts?!"  And it's not even an edit, it's copying the post from one box to another (a more hacky version of which is regarded as the "accepted" method). Getting disk i/o statistics for single process in Linux Let: $P(x) = a_nx^n + a_{n-1}x^{n-1} + ..... + a_1x + a_0$ where $a_0a_n &lt; 0$ I have to prove that the Polynomial $P(x)$ has at least one positive root how can I prove it? Any ideas?