Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1116
  • Last Modified:

Vi multiple searching

I used to vi editor as standard used. But I dont know how to do multiple searching....normally I able to search single words during vi.

for example:
1) vi filename.txt ( opening the file )
2) /wordthatiseek ( in vi editor i type this to search the words)

let say the /var/log/message file. i want to search line with date and some message
 example:
i want to search 20112007 and words 'failed'. what should i type after the '/'?

thanks
0
operation1612
Asked:
operation1612
1 Solution
 
terrydavisCommented:
Searching in vi is line based and you can use regular expressions.   So if you are looking for lines that contain both 20112007 and failed (in that order), try this:

:/.*20112007.*failed.*

Thanks,
Terry
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now