The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-14-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Assuming this precise sequence of host and sid is the deciding criterion, maybe something like

Code:
sed '/host=atlx3 sid=atld3/{;h;s/^/#/p;x;}' abc.txt
This takes a matching line and remembers it in the hold space (h); then substitutes a hash mark at beginning of line and prints the result; then swaps back the hold space (x) which will be printed as any other line a second time.
Reply With Quote