Previous: h-command Up: ../info.html Next: l-command
The "K" (keyword) command searches lines from the current position to the remainder of the file for one or more strings and displays all those which contain a match. The current node position is not changed, and the "." command (*Note .: Dot-Command) will redisplay the current screen after you have seen the keyword matches. With the "R" command prefix (*Note R: Regular-Expression-Search), the strings can specify complex pattern matches instead of ordinary string matches. Sometimes you do not know exactly what you are looking for, but can tell from context. In that case, you can save screen display by using the "K" (keyword) command to find the line you want, and then you can issue a more precise "S" command to find the desired line and position the display there. The search direction can be specified by the "<" and ">" commands (*Note <: Left-Angle-Command, *Note >: Right-Angle-Command), but if it has never been set, it defaults to forwards through the file. String matching is performed on each line separately, so matches cannot span line boundaries. For ordinary string searches, letter case is IGNORED in the search, but for regular expression pattern searches, letter case is significant. The search strings follow the "K" command, and if more than one is specified, they must be separated by vertical bars. Thus "Kone|two|three" will find all following, or preceding, lines, depending on the search direction, containing at least one of the strings "one", "two", or "three". If you need to search for a vertical bar, it can be "escaped" (turned into an ordinary character) by prefixing it with an at-sign, "@". Thus, "Kone@|two|three" would search for the strings "one|two" and "three". To get a literal at-sign into the search string, you simply escape it: "Kone@@two" searches for the string "one@two".