Using Regex to make a search inside Less ??
Hi,
I'm posting this question here because of the Regexp, if Im in the wrong place please let me know. The question is simples, can I search inside Less using a RegExp ? If the answer is yes, how can I make a backsearch for to word to be matched in the same line but in aleatory place with Regexp? Thanks ! Example: find the word hotmail and john in: John accessed this page: hotmail.com |
A quick scan of "man less" does not suggest that you can use normal Regexes, but there are some codes that look useful.
Have you tried it? For real searching with real Regexes, why not GREP, SED, or other common utilities? |
less does support regexp's:
Quote:
I don't think regexps are that great at doing the particular kind of search you want though, (John.*hotmail|hotmail.*John) is probably the best you can do (if you know John goes before hotmail you can use just the first half, of course). With grep you can use more than one regexp like this: Code:
grep John file | grep hotmail |
This file Im reading is a Log file of about 4gb, some weird problem made the syslog not to rotate the files and now I had to find some information requested by the company high board... using grep is normaly my first choice but in this case trying to quick the process I used the less and ? / to find what I want, of course I didnt hope to get the answer before the time I had to give the information to the board, but this doubt sticked in my head and I came here to ask maybe for a future know how...
btw, this logrotate problem will be my next thread, very strange thing, in old days just syslog was responsible for logging and stuff now Im having many problems trying to figure out who do what in the logging business lol but already was of good help your answers. thansk [ ]'s |
All times are GMT -5. The time now is 09:00 PM. |