But what if you only want to match a literal dot? If you escape the dot: "\.", it will only match another literal dot character in your text. In grep, a dot character will match any character except a return. To search for a backslash character itself, double it \\ so that its first appearance will escape the second.įor example, perhaps the most common "special character" in grep is the dot: ".". In this case, you must use the backslash character \ before that special character to have it be treated literally this is known as "escaping" the special character. However, sometimes you will need to include an exact, or literal, instance of these characters in your grep pattern. (The use of these characters is covered in the following sections.) In addition to the simple character matching discussed above, there are various special characters that have different meanings when used in a grep pattern than in a normal search. Very simple patterns, to be sure, but patterns nonetheless. This idea is so obvious that it seems not worth mentioning, but the important thing to remember is that these characters are search patterns. For instance, if you are looking for the letter "t", Grep stops and reports a match when it encounters a "t" in the text. Most characters that you type into the Find dialog box match themselves.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |