Evan N Mr Niso/Lockheed Martin Kehayias wrote:
> 
> Hello all,

Hello,

> I was hoping someone could steer me in the right direction for a scripting
> problem I am having.  The problem I am experiencing is using sed and vi.
> The solution I am attempting can most likely be done in perl but not sure
> how.  If anyone has any suggestions on how to accomplish it in perl - it
> would be much appreciated.
> 
> What I am attempting to do is read in a file and add text in specific
> locations.  The catch is I need to add text followed by carriage returns
> followed by more text and so on.  Below using sed I am attempting to find
> something in a file that will always be there like and replace accordingly:
> 
> trimmed file contents before:
> # Cmnd alias specification
> 
> trimmed file contents after:
> # Runas_Alias specification
> Runas_Alias     AP = acl
> 
> # Cmnd alias specification
> 
> I can do it on the command line using sed:
> 
> sed 's/\(\#\)\( Cmnd alias specification\)/\# Runas_Alias
> specification\^JRunas_Alias   AP = acl\1\2/' s1 > s3

perl -pe's{^(#)( Cmnd alias specification)}
          {# Runas_Alias specification\nRunas_Alias   AP = ac\n\nl$1$2}' s1 > s3



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to