Solved

multipe search criteria in vi

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now