Why does my grep search not find any matches when i loop through the pattern, but does when I write it in manualy? I am trying to list the number of occurrences of lines that contain a certain word within a file. The words I am looking for are stored in a separate file that I'm looping through with this code: cat swissprot_anims.txt | while read line do     grep &quot;$line&quot; swissprot_list.txt | wc -l done  Where swissprot_anims.txt is the file containing the keywords in this format: BOVINE CHICKEN DROSOPHILA MELANOGASTER HUMAN MOUSE PIG RAT XENOPUS LAEVIS MELANOGASTER  And swissprot_list.txt is the file I'm combing for matches: Acetylcholine (muscarinic) receptors ====================================  ACM1_HUMAN (P11229)   MUSCARINIC ACETYLCHOLINE M1 [CHRM1] - HUMAN ACM1_MOUSE (P12657)   MUSCARINIC ACETYLCHOLINE M1 [CHRM1] - MOUSE ACM1_PIG   (P04761)   MUSCARINIC ACETYLCHOLINE M1 (BRAIN) [CHRM1] - PIG ACM1_RAT   (P08482)   MUSCARINIC ACETYLCHOLINE M1 [CHRM1] - RAT ACM2_BOVIN (P41985)   MUSCARINIC ACETYLCHOLINE M2 [CHRM2] (FRAGMENT) - BOVINE ACM2_CHICK (P30372)   MUSCARINIC ACETYLCHOLINE M2 [CM2] - CHICKEN ACM2_HUMAN (P08172)   MUSCARINIC ACETYLCHOLINE M2 [CHRM2] - HUMAN ACM2_PIG   (P06199)   MUSCARINIC ACETYLCHOLINE M2 (CARDIAC) [CHRM2] - PIG ACM2_RAT   (P10980)   MUSCARINIC ACETYLCHOLINE M2 [CHRM2] - RAT ACM3_BOVIN (P41984)   MUSCARINIC ACETYLCHOLINE M3 [CHRM3] - BOVINE ACM3_HUMAN (P20309)   MUSCARINIC ACETYLCHOLINE M3 [CHRM3] - HUMAN ACM3_PIG   (P11483)   MUSCARINIC ACETYLCHOLINE M3 [CHRM3] - PIG ACM3_RAT   (P08483)   MUSCARINIC ACETYLCHOLINE M3 [CHRM3] - RAT ACM3_CHICK (P49578)   MUSCARINIC ACETYLCHOLINE M3 - CHICKEN ACM4_BOVIN (P41986)   MUSCARINIC ACETYLCHOLINE M4 [CHRM4] (FRAGMENT) - BOVINE ACM4_CHICK (P17200)   MUSCARINIC ACETYLCHOLINE M4 - CHICKEN ACM4_HUMAN (P08173)   MUSCARINIC ACETYLCHOLINE M4 [CHRM4] - HUMAN ACM4_MOUSE (P32211)   MUSCARINIC ACETYLCHOLINE M4 [CHRM4] - MOUSE ACM4_RAT   (P08485)   MUSCARINIC ACETYLCHOLINE M4 [CHRM4] - RAT ACM4_XENLA (P30544)   MUSCARINIC ACETYLCHOLINE M4 - XENOPUS LAEVIS ACM5_HUMAN (P08912)   MUSCARINIC ACETYLCHOLINE M5 [CHRM5] - HUMAN ACM5_RAT   (P08911)   MUSCARINIC ACETYLCHOLINE M5 [CHRM5] - RAT ACM1_DROME (P16395)   MUSCARINIC ACETYLCHOLINE DM1 [ACRC] - DROSOPHILA   But when I run the script it is unable to find matches this way, even though when I replace $line with RAT for example it finds the correct number of matches so the RAT that is read in from the file is somehow not equivalent to the RAT that I put in manually even though the read command should strip the lines of all whitespace (besides the fact that there is no whitespace in my file). What am I doing wrong here?
What is `^M` and how do I get rid of it? When I open the file in Vim, I see strange ^M characters.  Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here:   What is this ^M character? How could it have got there? How do I get rid of it?
$n$ balls are thrown randomly into $k$ bins - how many are empty? A large number of variants of this question were already asked here, including these - , , which are close, but none seem to answer my question. Assume that $n$ balls are thrown randomly and independently into $k$ bins.  What is the probability of finding $x$ empty bins? What is the expectation of the number of empty bins? After reading some articles on blender speed, I see that using CUDA enabled GPU computing will be of help in rendering.   I am trying to stitch a shirt on human .obj file. For that I bake 60 frames for it to fall on the human correctly. It takes about 20 seconds for the bake. I'd want to host it real time.  youtube link of the same :   Can I use GPU computing to reduce the bake time just like rendering time ? What is the difference between ++i and i++? In a table, how can I draw a horizontal line that goes only through some of the cells? I mean a line like the one in the Foo and in the Bar area of this table:  +----+-----+ |Foo |1 |2 | |    |1 |2 | |    +--+--+ |    |1 |2 | |    |1 |2 | +----+-----+ |Bar |1 |2 | |    |1 |2 | |    +--+--+ |    |1 |2 | |    |1 |2 | +----+--+--+ How do I change JPanel inside a JFrame on the fly? To put it simple, there's a simple java swing app that consists of JFrame with some components in it. One of the components is a JPanel that is meant to be replaced by another JPanel on user action.  So, what's the correct way of doing such a thing? I've tried  panel = new CustomJPanelWithComponentsOnIt(); parentFrameJPanelBelongsTo.pack();   but this won't work. What would you suggest? My neighbor keeps complaining about my music. How to soundproof my apartment? I live in an old apartment building and the walls are thin. This is a problem because I love to listen to music -- sometimes at odd hours of the night. Yes, I can be an asshole in this way. But my neighbor bangs against the wall even when I'm being perfectly reasonable (his bedroom seems to share a wall with my living room). And it's not just the low frequencies that get to him. He knocks against the wall even when I turn the subwoofer off on my speakers, which are located on the opposite wall.   This is kinda unacceptable. This is my home! What can I do so that I can live in it the way I want? Spanning Trees: Prove if $e_1$ is an edge in $X$ that isn't in $Y$, then there exists an edge ... Say $X$ and $Y$ are two different spanning trees of a simple and connected and undirected graph $G$. Prove that if $e_1$ is an edge in $X$ that isn't in $Y$, then there exists an edge $e_2$ in $Y$ that isn't in $X$... so the graph $(X − e_1) + e_2$ (obtained from $X$ on replacing $e_1$ by $e_2$) is also a spanning tree of the original graph, $G$. Proof of "well-founded iff there is no sequence $x_n$ s.t. $(x_{n+1}, x_n) \in R$" I tried to do the following exercise from a book I'm reading, can you tell me if my solution is correct? Thanks!  Theorem 2: Let $R$ be a binary relation on a set $X$. Then $R$ is strictly well-founded iff there is no sequence $(x_n)_{n \in \mathbb N}$ of elements of $X$ such that $(x_{n+1}, x_n) \in R$ for all $n \in \mathbb N$.  Exercise:  (i) Formulate an analogue of Theorem 2 for  well-founded relations.   (ii) Prove Theorem 2.    (i) Theorem 2': Let $R$ be a binary relation on a set $X$. Then $R$ is well-founded iff there is no sequence $(x_n)_{n \in \mathbb N}$ of elements of $X$ such that $(x_{n+1}, x_n) \in R$ and $x_n \neq x_{n+1}$ for all $n \in \mathbb N$.  (ii)   $\implies$: Assume there is a sequence $x_n$ with $(x_{n+1},x_n) \in R$ for all $n \in \mathbb N$. Then the set $Y = \{x_n \mid n \in \mathbb N\}$ and hence $R$ is not well-founded since for every element $x_n$ there is $x_{n+1} \in Y$ with $(x_{n+1},x_n) \in R$.  $\Longleftarrow$: Let $R$ be strictly well-founded. Assume we have a sequence $x_n$ with $(x_{n+1},x_n) \in R$ for all $n \in \mathbb N$. Then by the same argument as above $R$ is not well-founded, hence there cannot be such a sequence.   I must be missing something but I can't seem to figure out what. I am no native speaker and always confused about the comma in introductory phrases, in particular in prepositional phrases. Is there any hard rule when a comma must be set? If I make a google search for certain phrases, I often find both variants. Typical examples where I am not sure whether a comma must be set are:        First[ly][,] I must phone mother   In this case[,] we must...   For simple problems[,] the algorithm...   From Lemma 1.2[,] we obtain...   For a typical user[,] the algorithm...   In our theory[,] we...   A dark line on the horizon[,] the mountain range we were headed for seemed somehow not as threatening as when we had started out on the trip.   Avidly reading her novel[,] Jane did not notice that her stop was approaching.   To be sure[,] it is not easy to see a solution.   When you get to Rome[,] give me a ring. System.QueryException: List has no rows for assignment to SObject I have this controller but I am getting this error      System.QueryException: List has no rows for assignment to SObject   public class MyController {     private final Account account;      public MyController() {         account = [SELECT Id, Name, Site FROM Account                     WHERE Id = :ApexPages.currentPage().getParameters().get('id')];             }      public Account getAccount() {         return account;     }      public PageReference save() {         update account;         return null;     } } How can I make two columns in two columns How can I make two columns in two columns same as in the picture? Find a plane that passes through a point and is perpendicular to 2 planes Find an equation of a plane that passes through $p(1,5,1)$ and is perpendicular to planes $2x+y-2z = 2$ and $x+3z=4$.  I basically need the 2 other points to make the vector and perform the cross product.  Since $ax+by+cz+d=0$ is the form of a plane. Can I obtain the points as $(a,b,c)$ of the 2 planes given? Also, how can I set them up to obtain the points? How can I Remove .DS_Store files from a Git repository? How can I remove those annoying Mac OS X .DS_Store files from a Git repository? Can't do comparison on PageReference In my page constructor I call a method isFirstPageLoaded, to  check if the loaded page is the first page of the wizard.   private final PageReference FIRSTPAGE = Page.Maintenance_Lock_1;   private void isFirstPageLoaded() {          if(ApexPages.currentPage()!=this.FIRSTPAGE) {              throw new MaintenanceLockException(this.FIRSTPAGE + ' --- ' + ApexPages.currentPage());          }      }   The problem is: Even if I open the first page of the wizard, the exception is thrown. How can I compare two PageReferences? I would like to avoid to parse the URLs and remove parameters etc... How many Shutter Clicks on a New Camera considered normal?    I purchased a quotes new Nikon D750 and checked the shutter count and it has 264 Shutter Clik count on it.    Is that suspect of a returned purchase or used camera? Retrieve Force.com registered domain Showing that $\Bbb R[x] / \langle x^2 + 1 \rangle$ is isomorphic to $\Bbb C$ question consider the following subsets of complex plane $$\Omega_1=\left\{c\in\Bbb C:\begin{bmatrix}1&amp;c\\\bar c&amp;1\\ \end{bmatrix}\text{ is non-negative definite } \right\} $$  $$\Omega_2= \left\{c\in\Bbb C:         \begin{bmatrix}         1 &amp; c &amp; c \\         \bar c &amp; 1 &amp; c \\         \bar c &amp; \bar c &amp; 1 \\         \end{bmatrix} \text{ is non-negative definite } \right\}$$  Let $$\bar D=\{z\in\Bbb C:|z|\le1\}$$ Then 1) $\Omega_1=\bar D,\Omega_2=\bar D$  2). $\Omega_1\neq\bar D, \Omega_2=\bar D$  3). $\Omega_1=\bar D, \Omega_2\neq\bar D$  4). $\Omega_1\neq\bar D, \Omega_2\neq\bar D$  How to proceed? Thank you. Please consider gathering Meta feedback before the "ship" stage Catching exceptions from a constructor's initializer list