* dos batch string manipulation
@ 2011-10-17 22:30 Alin Rus
2011-10-18 1:38 ` Frantisek Hanzlik
0 siblings, 1 reply; 3+ messages in thread
From: Alin Rus @ 2011-10-17 22:30 UTC (permalink / raw)
To: linux-msdos
Hello,
I'm trying to write some dos batch script for manipulating some paths.
I haven't done this in years so I might be rusty.
The path is relative and given from the command line as argument
@echo off
set wpath=%1
@echo.%wpath%
set newpath=%wpath:~0,-4%
@echo.%newpath%
The thing I'm trying to accomplish is to get rid of the extension
script.bat whatever/test.txt
whatever/test.txt
whatever/test
But I'm getting
script.bat whatever/test.txt
whatever/test.txt
<emptyline>
I'm using dosemu-1.4.0.1 and this [1] as a reference.
[1] http://www.dostips.com/DtTipsStringManipulation.php
Regards,
--
Alin Rus
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dos batch string manipulation
2011-10-17 22:30 dos batch string manipulation Alin Rus
@ 2011-10-18 1:38 ` Frantisek Hanzlik
2011-10-18 6:00 ` Frank Cox
0 siblings, 1 reply; 3+ messages in thread
From: Frantisek Hanzlik @ 2011-10-18 1:38 UTC (permalink / raw)
To: Alin Rus; +Cc: linux-msdos
Alin Rus wrote:
> Hello,
>
> I'm trying to write some dos batch script for manipulating some paths.
> I haven't done this in years so I might be rusty.
>
> The path is relative and given from the command line as argument
>
> @echo off
> set wpath=%1
> @echo.%wpath%
> set newpath=%wpath:~0,-4%
> @echo.%newpath%
>
> The thing I'm trying to accomplish is to get rid of the extension
>
> script.bat whatever/test.txt
> whatever/test.txt
> whatever/test
>
> But I'm getting
>
> script.bat whatever/test.txt
> whatever/test.txt
> <emptyline>
>
>
> I'm using dosemu-1.4.0.1 and this [1] as a reference.
>
>
> [1] http://www.dostips.com/DtTipsStringManipulation.php
>
>
> Regards,
Hello Alin,
it seems as scripts at referenced www.dostips.com are for cmd.exe
shell in win xp and newer. Thus examples there mentioned will not
work at win 95/98/me and of course at neither version of MS DOS up
to last 6.22.
I think You may solve this string manipulation task
1) with some external programs, which are able do string manipulation
- You can find them e.g. on Simtel.net.
2) maybe some command.com shell replacement is able do it too.
3) other way may be use awk for DOS for creating some.bat file
in form:
set newpath=SomeAWKcreatedString
and then call it for setting newpath:
call some.bat
Best, Franta
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dos batch string manipulation
2011-10-18 1:38 ` Frantisek Hanzlik
@ 2011-10-18 6:00 ` Frank Cox
0 siblings, 0 replies; 3+ messages in thread
From: Frank Cox @ 2011-10-18 6:00 UTC (permalink / raw)
To: Alin Rus; +Cc: linux-msdos
On Tue, 18 Oct 2011 03:38:31 +0200
Frantisek Hanzlik wrote:
> 1) with some external programs, which are able do string manipulation
You may want to look at The Berkley Utilities (berk.zip) which is a set of 40
Unix commands that have been ported to DOS, including sed and awk.
--
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-18 6:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 22:30 dos batch string manipulation Alin Rus
2011-10-18 1:38 ` Frantisek Hanzlik
2011-10-18 6:00 ` Frank Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox