Remove space in output

View: New views
7 Messages — Rating Filter:   Alert me  

Remove space in output

by John Black-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am writing a database backup script in PHP which allows the user to
generate a Windows batch file. Problem is that I get a space after the
variable when I echo a test string.

Batch Code:
@ECHO OFF
for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
set datestr=%d:~6,4%%d:~0,2%%d:~3,2%
set sqldumpfile=Database_dump-%datestr%.sql
echo %sqldumpfile%

This gives me the output of:
Database_dump-20080609 .sql

Notice the space after the date and .sql. How can I get rid of it?

Thanks

John

Re: Remove space in output

by John Black-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

John Black wrote:

> I am writing a database backup script in PHP which allows the user to
> generate a Windows batch file. Problem is that I get a space after the
> variable when I echo a test string.
> Batch Code:
> @ECHO OFF
> for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
> set datestr=%d:~6,4%%d:~0,2%%d:~3,2%
> set sqldumpfile=Database_dump-%datestr%.sql
> echo %sqldumpfile%
> This gives me the output of:
> Database_dump-20080609 .sql
> Notice the space after the date and .sql. How can I get rid of it?
> Thanks
> John

It took me a while but I finally figured out where the problem was, I
had an additional space in the PHP code which generates the batch file.

This has an extra space behind ~3,2%
$batch .= 'set datestr=%d:~6,4%%d:~0,2%%d:~3,2% '."\r\n";

It works fine now as:
$batch .= 'set datestr=%d:~6,4%%d:~0,2%%d:~3,2%'."\r\n";

--
John


Re: Remove space in output

by foxidrive-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 11 Jun 2008 09:51:29 -0400, John Black
<spam@...> wrote:

>John Black wrote:
>> I am writing a database backup script in PHP which allows the user to
>> generate a Windows batch file. Problem is that I get a space after the
>> variable when I echo a test string.
>> Batch Code:
>> @ECHO OFF
>> for /f "tokens=1,2" %%u in ('date /t') do set d=%%v
>> set datestr=%d:~6,4%%d:~0,2%%d:~3,2%
>> set sqldumpfile=Database_dump-%datestr%.sql
>> echo %sqldumpfile%
>> This gives me the output of:
>> Database_dump-20080609 .sql
>> Notice the space after the date and .sql. How can I get rid of it?
>> Thanks
>> John
>
>It took me a while but I finally figured out where the problem was, I
>had an additional space in the PHP code which generates the batch file.
>
>This has an extra space behind ~3,2%
>$batch .= 'set datestr=%d:~6,4%%d:~0,2%%d:~3,2% '."\r\n";
>
>It works fine now as:
>$batch .= 'set datestr=%d:~6,4%%d:~0,2%%d:~3,2%'."\r\n";

Glad you got it sorted.  Your posts only just popped up here.


Change email address

by Byrne, Derek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

  I'm looking to change my Email address - anyone know how I can unsubscribe from this mailing list and re-subscribe with my new email address?

  Cheers,

Derek "The Happy One" Byrne

 

******************************************
Meteor Mobile Communications Limited, trading as Meteor.
Registered Office: 4030 Kingswood Avenue, Citywest Business Park, Naas Road, Dublin 24, Ireland.
Registered in Ireland: 282645

 
DISCLAIMER: This email and its attachments contain confidential information and may be legally privileged. The message is intended only for the addressee(s) stated above.  If you are not the named addressee(s) or intended recipient please do not use, copy, disseminate or disclose the information to anyone.  If you have received this email in error please immediately notify the sender at Meteor and delete the material from any system and destroy any copies.
******************************************


[Non-text portions of this message have been removed]


RE: Change email address

by Morris, Lamar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...

Old address

To Subscribe, send a blank message to: batchworld-subscribe@...

New address

 

Lamar

 

________________________________

From: batchworld@... [mailto:batchworld@...] On
Behalf Of Byrne, Derek
Sent: Wednesday, June 11, 2008 11:14 AM
To: batchworld@...
Subject: [BATCH WORLD] Change email address

 

Hi All,

I'm looking to change my Email address - anyone know how I can
unsubscribe from this mailing list and re-subscribe with my new email
address?

Cheers,

Derek "The Happy One" Byrne

******************************************
Meteor Mobile Communications Limited, trading as Meteor.
Registered Office: 4030 Kingswood Avenue, Citywest Business Park, Naas
Road, Dublin 24, Ireland.
Registered in Ireland: 282645

DISCLAIMER: This email and its attachments contain confidential
information and may be legally privileged. The message is intended only
for the addressee(s) stated above. If you are not the named addressee(s)
or intended recipient please do not use, copy, disseminate or disclose
the information to anyone. If you have received this email in error
please immediately notify the sender at Meteor and delete the material
from any system and destroy any copies.
******************************************

[Non-text portions of this message have been removed]

 



[Non-text portions of this message have been removed]


Re: Change email address

by Michael Burek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Click the link at the bottom of the e-mail that says "Change settings via
the Web."  You have to log into Yahoo.

On Wed, Jun 11, 2008 at 11:13 AM, Byrne, Derek <Derek.Byrne@...>
wrote:

>   Hi All,
>
> I'm looking to change my Email address - anyone know how I can unsubscribe
> from this mailing list and re-subscribe with my new email address?
>
> Cheers,
>
> Derek "The Happy One" Byrne
>
> ******************************************
> Meteor Mobile Communications Limited, trading as Meteor.
> Registered Office: 4030 Kingswood Avenue, Citywest Business Park, Naas
> Road, Dublin 24, Ireland.
> Registered in Ireland: 282645
>
> DISCLAIMER: This email and its attachments contain confidential information
> and may be legally privileged. The message is intended only for the
> addressee(s) stated above. If you are not the named addressee(s) or intended
> recipient please do not use, copy, disseminate or disclose the information
> to anyone. If you have received this email in error please immediately
> notify the sender at Meteor and delete the material from any system and
> destroy any copies.
> ******************************************
>
> [Non-text portions of this message have been removed]
>
>  
>


[Non-text portions of this message have been removed]


Re: Remove space in output

by John Black-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

foxidrive wrote:
>
> Glad you got it sorted.  Your posts only just popped up here.

Thanks, first I thought my post got lost but since I showed up today I
knew I was on moderation for my first post. This is also why I sent my
solution as to stop others from wasting there time answering a already
solved problem.

Proud to be a full member now :)

Till next time

--
John

LightInTheBox - Buy quality products at wholesale price