Hi,
I am trying to search for a string in a file and print all the matched lines as pipe delimited format.
My command is
cat m_gid_trans.XML|grep -i '<TABLEATTRIBUTE NAME ="Lookup cache directory name"'
The output I am getting is
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="PMCacheDir"/>
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="$PMCacheDir"/>
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="$PMCacheDir"/>
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="/gid/Cache"/>
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="$PMCacheDir"/>
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="$PMCacheDir"/>
My desired output is something like
<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="$PMCacheDir"/>|<TABLEATTRIBUTE NAME ="Lookup cache directory name" VALUE ="$PMCacheDir"/>
I tried to put
sed -e :a -e 'N;s/\n/|/; ta'
at the end of the command and run, but it did not show any result.
Please help,
Thanks