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 07-03-2009
jansonx jansonx is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
Question It doesn't seem to work well under Solaris

First, -i option was not supported, so the above sed -i "N c $var " datafile is not portable.
Second, even if the -i option is not provided, using sed -i "N c[\] $var" datafile, still it cannot work.
The solution might be,
sed "N c\\
$var" datafile
which I tested under Solaris.

John, Hong

p.s.
sed "N s/.*/$var/" datafile also works out.

Last edited by jansonx; 07-03-2009 at 07:01 AM.. Reason: I got the answer