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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to remove space in sed for / character vasanth_vadalur Shell Programming and Scripting 3 06-17-2009 10:09 AM
to remove space in a txt file manit UNIX for Dummies Questions & Answers 19 01-13-2009 11:14 AM
to remove space after numeric ali560045 Shell Programming and Scripting 2 09-17-2008 06:23 AM
how to get a space between the result of (date +%d) command ladtony Shell Programming and Scripting 12 09-09-2008 01:41 PM
remove space characters melanie_pfefer Shell Programming and Scripting 1 03-11-2008 01:45 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-10-2009
asirohi asirohi is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 56
How to remove space in between the result

Hi All,

How do i remove the spaces in between, the outputted result: my output is like below and i dont want spaces between them, how do i do that. I am enclosing the peice of code that does that:-


Code:
 if [ $? -eq 0 ]; then
 $ECHO "The Path is:" $OFFERING_FILE_PATH/$z
 $ECHO $Z
 else
 $ECHO ""
 fi
##############################################
Output:-


Code:
Words to be searched: CCRCWebServerINSTALLDIR
The Path is: /home/administrator/testfix/install/cc.offering/com.ibm.rational.cl
earcase.assembly.assembly
<includedShareableEntity id="CCRCWebServerINSTALLDIR">














Words to be searched: ClearCaseAdministrationTools-CINSTALLDIR
The Path is: /home/administrator/testfix/install/cc.offering/com.ibm.rational.cl
earcase.assembly.assembly
<includedShareableEntity id="ClearCaseAdministrationTools-CINSTALLDIR">














Words to be searched: ClearCaseAdministrationTools-ent-CINSTALLDIR
The Path is: /home/administrator/testfix/install/cc.offering/com.ibm.rational.cl
earcase.assembly.assembly
<includedShareableEntity id="ClearCaseAdministrationTools-ent-CINSTALLDIR">
  #2 (permalink)  
Old 08-10-2009
peterro peterro is offline
Registered User
  
 

Join Date: Jul 2009
Location: Gresham, OR
Posts: 153
It looks like that is from the contents of $Z. How does $Z get defined?
  #3 (permalink)  
Old 08-10-2009
asirohi asirohi is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 56
Hi Peterro,

The Z variable is defined as:-
Z=`find $OFFERING_FILE_PATH/$z | xargs grep $i`

Thanks for coming to help again

-Adi
  #4 (permalink)  
Old 08-10-2009
malcomex999 malcomex999 is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 151
why do u need the below code from ur code???

Code:
 else
 $ECHO ""
  #5 (permalink)  
Old 08-10-2009
peterro peterro is offline
Registered User
  
 

Join Date: Jul 2009
Location: Gresham, OR
Posts: 153
Ok, what is $i? Is this script really large, or would it be appropriate to post all of it here? What I'm trying to get at is that if you can just gather the data you want, the output won't look so bad. From what I see so far, it looks like your getting too much of something (blank lines) when defining variables.
  #6 (permalink)  
Old 08-10-2009
asirohi asirohi is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 56
Sure,
There is no problem posting it here:-

Code:
#!/bin/sh

ECHO=/bin/echo
CAT=/bin/cat
LS=/bin/ls
AWK=/bin/awk
GREP=/bin/grep

FIX_XML_PATH=/home/administrator/testfix/fix
FIX_FILE=`$LS $FIX_XML_PATH | $GREP xml`
OFFERING_FILE_PATH=/home/administrator/testfix/install/*.offering
OFFERING_FILE=`$LS $OFFERING_FILE_PATH | $GREP assembly`

Y=`$CAT $FIX_XML_PATH/$FIX_FILE | $GREP id | $AWK '{if($2 ~ /id=/) pri
nt $2}' | $AWK -F"'" '$1 == "id=" {print $2}'`

for i in $Y
do
 $ECHO "Words to be searched:" $i
 for z in $OFFERING_FILE
  do
   #$ECHO "The Path is:" $OFFERING_FILE_PATH/$z
   #Z=`find $OFFERING_FILE_PATH/$z -exec grep  $i {} \;`
   Z=`find $OFFERING_FILE_PATH/$z | xargs grep $i`

   if [ $? -eq 0 ]; then
   $ECHO "The Path is:" $OFFERING_FILE_PATH/$z
   $ECHO $Z
   else
   $ECHO ""
   fi

  done
  #7 (permalink)  
Old 08-10-2009
peterro peterro is offline
Registered User
  
 

Join Date: Jul 2009
Location: Gresham, OR
Posts: 153
Yup, I think malcomex999 has the answer. Change the
Code:
echo ""
to
Code:
echo "this line intentionally left blank"
and see what you get.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0