According to the man page of grep,Anchoring       The  caret  ^ and the dollar sign $ are meta-characters that respectively match the empty string at the beginning and end of a line.Say I have a text file:HelloIn the housedancing in raini like rainIf I use:grep like^i fileI will get a mismatch because no character can exist before the first character (^).By the same logic,grep n$anything fileshould give me mismatch always because no character can exist after last character, right?But it doesn't.It gives me all lines containing n.Question: Does meaning of $ change based on where you place it?
How '$' works with grep command in bash
shell;grep;regular expression