The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 06-17-2008
radoulov's Avatar
radoulov radoulov is online now Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,854
Quote:
Originally Posted by kahuna View Post
Radoulov,



Could you explain a little more on how the second perl solution works? I can't figure out how the substitute knows which "ExitAction = NONE" to substitute. I see that you're qualifying it with the if statement, but I still don't see how that makes the substitute get right "ExitAction = NONE" and not the first "ExitAction = NONE" .
Sure,
the -00 flag+argument turns the paragraph mode on.
From perldoc perlrun:

Quote:
Switches include:

-0[octal/hexadecimal]
specifies the input record separator ($/) as an octal or hexadeci-
mal number. If there are no digits, the null character is the
separator.
[...]

The special value 00 will cause Perl to slurp files in paragraph
mode. The value 0777 will cause Perl to slurp files whole because
there is no legal byte with that value.
In this mode each record is a paragraph of text terminated by one or more empty lines.
So change the ExitAction only for the record(s)/paragraph(s) that begin with the pattern "Task sipsiproc".