The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: sed question
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-07-2007
arushunter arushunter is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 31
sed question

I have a file that conatins following info

Policy1=U|guestRoom=test1idCode=5(1):!:Amenity2=U|RoomId=testrma=4(1):!:|
GuestRoomAmenity1=U|guestRoomId=testguest1id^rmaCode=5(1):!:|

I need it to look like this

Policy1=U|guestRoom=test1idCode
Amenity2=U|RoomId=testrmaCode
GuestRoomAmenity1=U|guestRoomId=testguest1idrmaCode


Basically need to cut out "\([0-9]\):!:" and start the remaining on the next line.

I am trying to use following sed command
sed -e 's/([0-9]):!:/\n/g' $FILE > $TEMP_FILE && mv $TEMP_FILE $FILE

but I am not getting righ result.
What I am getting is
Policy1=U|guestRoom=test1idCode\nAmenity2=U|RoomId=testrmaCode...

So for some reason "\n" does not work.
Any ideas on what is wrong here?
Thank you in advance