Solved

Vi multiple searching

Posted on 2007-11-20
1
1,109 Views
Last Modified: 2013-12-16
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
Comment
Question by:operation1612
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
terrydavis earned 50 total points
ID: 20320199
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question