Solved

Find string in file

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
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.

695 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