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 -->
  #2 (permalink)  
Old 10-09-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
Wink Here is one approach

Code:
> cat file3
<voms.db.type 
value="changeme"/>
<voms.db.host
value="changeme"/> 
<voms.admin.smtp.host 
value="changeme"/>
<voms.mysql.admin.password 
value="changeme"/>
<glite.installer.verbose 
value="true"/>
> sed "s/>/>~/g" file3 | tr -d "[ ][\n]" | tr "~" "\n"
<voms.db.typevalue="changeme"/>
<voms.db.hostvalue="changeme"/>
<voms.admin.smtp.hostvalue="changeme"/>
<voms.mysql.admin.passwordvalue="changeme"/>
<glite.installer.verbosevalue="true"/>
>
Explained...
substitute > with >~ so can easily find end-of-lines
delete space and new-line characters
(note, the sample I copied/pasted had extra spaces after data in some lines)
then substitute new-lines for the ~ I used as marker in first step

Expect someone to offer an easier solution, but this is one approach