Solved

multipe search criteria in vi

Posted on 2011-03-23
5
369 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
  • 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

777 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