Montag, 5. Mai 2014

Negative Look Ahead in less

The Unix tool 'less' is often used to view log files on Unix systems. But sometimes it is hard to find the right place. Less supports extended regular expressions to search through the log file. Extended means that Less supports unlike many other Unix tools "look ahead" expressions. This is very useful if you try to find the occurrence of "50" but not "500". The following expression will search for a "50" not followed by a second "0":
/50(?!0)

Keine Kommentare: