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 -->
  #1 (permalink)  
Old 10-01-2008
krishna.fuji krishna.fuji is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 5
Thumbs up Grep, then format then prepare a string

Hi

I have a file which is having line like below

Personal Unit=AU003 (Industrial Products Division),Plant=B00089,Departmant=D110

When ever i fine line starting sith Personal Unit and contains Plant Department I need to pick this line and format it like

Personal Unit=AU003
Plant=B00089
Departmant=D110
-->RAM:AU003:B00089110:system date:header of the file

i used sed

sed -e '/Personal Unit/{;h;s/^/#/p;x;}' -e '/Business Unit/{s/,Plant/\nPlant/g' -e 's/,Departmant/\nDepartmant/g'} FileName

But it is not fullfilling my all need
can any one please suggest