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 the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 07-17-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Cool Made a couple of assumptions, but it works

Assumed that the packageNumber was always eight characters and date was always ten characters in length. Hence the 8 and 10 in my command below.


Code:
> cat sample2
************************
* packageNumber : 1.0.0.14 *
* date : 2008.02.08 *
************************
> echo $str
1.0.0.15
> echo $timeStamp
2008.03.08
> cat sample2 | sed "s/date : .\{10\}/date : $timeStamp/" | sed "s/packageNumber : .\{8\}/packageNumber : $str/"
************************
* packageNumber : 1.0.0.15 *
* date : 2008.03.08 *
************************