1844191 Members
2767 Online
110229 Solutions
New Discussion

delete a blank space

 
SOLVED
Go to solution
kholikt
Super Advisor

delete a blank space

Hi,

I am writing some script to output as ASCII delimited text.

"omnimm -media_info $RESULT -detail | awk -F ":" '/Pool name/{print $2";N/A";}' | sed 's/ //'"

But the end result always "TRP_SAP_Archive_DDS ;N/A" There is a blank space " ;N/A" I thought I can use sed 's/ //' to remove the space but it doesn't work.
abc
3 REPLIES 3
Biswajit Tripathy
Honored Contributor
Solution

Re: delete a blank space

Are you sure you don't have a blank space at the
beginning of the statement? I tried
sed 's/ //' and it worked fine on my system. If you
have a blank space at the beginning, you should try
sed 's/ //g'

- Biswajit
:-)
Masatake Hanayama
Trusted Contributor

Re: delete a blank space

Just FYI, in case of blanks appearing in the middle of Pool name, etc.,
the following will remove only leading and trailing blanks.

... awk -F ":" '/Pool name/{print $2;}' | sed -e 's/^ *//' -e 's/ *$/;N\/A/'

Regards,
RATEFIARIVONY
Occasional Advisor

Re: delete a blank space

sed -e 's/[ \t]*//g' will delete any blank space and tabs ...