Solved

Find string in file

Posted on 2008-10-27
2
292 Views
Last Modified: 2012-05-05
Hello experts,
Please help me to find solution for the following problem:
In file I need to find string "PORT" between Some 2 other strings. For exmple between "START_BLOCK_1:" and "END_BLOCK" and after that
between "START_BLOCK_2:" and "END_BLOCK"

START_BLOCK_1:
aaa
bbb
PORT=
ccc
ddd
END_BLOCK
START_BLOCK_2:
eee
fff
PORT=
hhh
jjj
END_BLOCK

Thanks




 
0
Comment
Question by:IKeystone
2 Comments
 
LVL 12

Accepted Solution

by:
jazzIIIlove earned 500 total points
ID: 22816535
0
 
LVL 84

Expert Comment

by:ozo
ID: 22816674
perl -ne 'print if (/START_BLOCK/../END_BLOCK/) && /PORT/'
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

17 Experts available now in Live!

Get 1:1 Help Now