I'm using less to view a large file and I want to search for a pattern with wildcards — e.g., " x 1??" where ? is any character. Does less support that, and if so how would I do that interactively?
Asked
Active
Viewed 1.5k times
7
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
feetwet
- 187
- 1
- 2
- 9
-
3`less` search is regex so `x 1..` – jordanm Apr 06 '15 at 15:30
-
You may find this helpful: http://linux.about.com/library/cmd/blcmdl1_less.htm – Elder Geek Apr 06 '15 at 15:42
-
1Not quite a duplicate: I wasn't able to determine through previous searching that less search uses regex, so @jordanm has the answer. Could he post it as such? – feetwet Apr 06 '15 at 23:20
1 Answers
11
The search in less uses regular expressions. To accomplish the search you are looking for, simply replace the shell wildcard ? with ..
/x 1..
jordanm
- 41,988
- 9
- 116
- 113