Solved

multipe search criteria in vi

Posted on 2011-03-23
5
372 Views
Last Modified: 2013-12-06
I have a vi editor

Q1 I need to search text in a large file for multiple criteria like

date should be 03/23/2011 and text should be abc

:? 03/23/2011 abc

Q2. I want to search for last occurance of word abc in the vi editor
0
Comment
Question by:gram77
[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
  • 3
  • 2
5 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
ID: 35200970
Q1:
In the command mode:
Enter the following
:/\03\/23\/2011 abc


Q2:
In the command mode
G
:?abc
0
 

Author Comment

by:gram77
ID: 35201057
/\03\/23\/2011 abc does not work
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 500 total points
ID: 35201891
I am sorry, I mistyped it

/03\/23\/2011 abc

If that doesn't work

Try
/03\/23\/2011.*abc

Also try
/03.23.2011.*abc


All of the above should work
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35201924
For question 1:
If you are at the top of the file  (if not you can do 'gg'), or at the bottom of the file (or you can go to the bottom by pressing G)you can do

:?abc
0
 

Author Closing Comment

by:gram77
ID: 35204882
excellent
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

632 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