Re: Need script to find the line which occurse after a given line
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- Date: 16 Feb 2006 17:37:04 GMT
On 15 Feb 2006 22:42:18 -0800, mailursubbu@xxxxxxxxx wrote:
Hi,[...]
I have file as below
Process= Proc1
{
Color=Red
Size=20
}
Process=Proc2
{
Color=Blue
Size=88
}
Now My script should take two parametes. ProcX and the property which
needs to be changed as below
Myscript Proc2 Color=Black
I would do it as:
perl -0777 -pi -e '
s/(Process\s*=\s*Proc2\s*\{.*?\sColor\s*=)[^\n]*/$1Black/s' file
That assumes there's a "Color" field in every "Process" entry.
--
Stephane
.
- Follow-Ups:
- Re: Need script to find the line which occurse after a given line
- From: mailursubbu
- Re: Need script to find the line which occurse after a given line
- References:
- Need script to find the line which occurse after a given line
- From: mailursubbu
- Need script to find the line which occurse after a given line
- Prev by Date: Re: Adding up numbers in a file
- Next by Date: Re: deleting a penultimate line from the standard output
- Previous by thread: Need script to find the line which occurse after a given line
- Next by thread: Re: Need script to find the line which occurse after a given line
- Index(es):
Relevant Pages
|
|