Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to write a Unix Shell Script command that would clean up the XML files by eliminating spaces between the nodes...example:
James
the command has to make:
Jamesanyone has clues ???
Thanks

I'm not sure of your requirements, but it looks like you want to eliminate blank lines. You can eliminate null lines (entirely empty) with either:
grep -v '^$' myfile > mynewfile
awk 'length!=0' myfile > mynewfileOr if you want to eliminate both the null lines and lines that contain only white space, you could use:
awk 'NF>0' myfile > mynewfile

Hi!
If u want to remove space, u can use the following command:-
sed "s/ *//g"i.e sed "s/*//g" {ur input file}
This will output the required file on screen.
U can redirect this to any file using >For ex: sed "s/ *//g" myxml >reqxml
If u want to remove spaces or tabs, then u can use this (Pls try following...I am not sure at this moment for this)
sed "s/[ ]*//g" {Input File}
i.e sed "s/[]*//g" {input file}
I hope this will server u

I think you have to read the XML document using XML processor/parser and then write it again.
I think that using unix commands will not be that useful.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |