Solved

Find string in file

Posted on 2008-10-27
2
294 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

778 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