Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

BATCH - replace vowels

Name: Anonymous 2009-05-17 6:07

help me, /prog/, you are my only hope!
i need to write a .bat that goes through a text and replaces all vowels by another character. don't ask for sense in that.
here is my code:

SET ersatz=a
:SchleifeVok
SET Zeichen=%Inhalt:~0,1%
SET Inhalt=%Inhalt:~1%
 ---> goes through the text, takes first character
FOR %%i in (a e i o u ä ö ü) DO IF ("%Zeichen%"=="%%i")  (ECHO %Ersatz%>>chinesen2.txt) ELSE (ECHO %Zeichen%>>chinesen2.txt)
 --> if the current character is either a e i o u ä ö ü, it will replace that with %Ersatz%
IF "%inhalt%"=="" (PAUSE) ELSE (GOTO SchleifeVok)

anyways, this does not work - neither does it replace ANY character nor does it ECHO the text correctly, but the biggest problem is how the replacement is not working.
tell me, /prog/, how do i fix this??

Name: Anonymous 2009-05-17 6:09

oh, and just to make that clear:
%Inhalt% is the content of the entire text
%Zeichen% is the current character

Name: Anonymous 2009-05-17 6:09

fuck yeah german

Name: Anonymous 2009-05-17 6:46

sed -e 's/[aeiou]/C/g' file

Name: Anonymous 2009-05-17 7:29

Hello, AnonTalk spammer.
Use a better scripting language than .bat

HTH HAND

Name: Anonymous 2009-05-17 7:38

1) not an AnonTalk spammer
2) not my choice, have to do it that way

Name: Anonymous 2009-05-17 7:46

>>4
German has many more vowels than that.

Name: Anonymous 2009-05-17 7:51

download cygwin learn bash

Name: Anonymous 2009-05-17 8:06

anybody willing to help me?
my posted code seems pretty legit to me, there must be some minor mistake in it...

Name: Anonymous 2009-05-17 8:32

>>9
I have helped you in >>4. Please go away.

Name: Anonymous 2009-05-17 8:35

>>9
my posted code seems pretty legit to me
That's what everyone thinks

(a e i o u ä ö ü)
I haven't programmed a .bat in years but have you tried ("a" "e" "i" "o" "u" "ä" "ö" "ü") instead

Name: Anonymous 2009-05-17 8:40

>>11
tried, did not work

Name: Anonymous 2009-05-17 9:04

bash-3.2$ cat > chinesen
what a bunch of crap
bash-3.2$ cat chinesen | sed 's/[aeiou]/a/g'
what a banch af crap
bash-3.2$ _

Name: Anonymous 2009-05-17 9:12

In addition:
SET ersatz=a
ECHO %Ersatz%>>chinesen2.txt

ersatz is something different than Ersatz.
If you knew anything about programming that is more sophisticated than BASIC, you'd know that.

Name: Anonymous 2009-05-17 10:09

Name: Anonymous 2009-05-17 10:32

YOU.
ALL.
SUCK.
found this solution:

SET inhalt=%inhalt:e=a%
SET inhalt=%inhalt:i=a%
SET inhalt=%inhalt:o=a%
SET inhalt=%inhalt:u=a%
SET inhalt=%inhalt:ä=a%
SET inhalt=%inhalt:ö=a%
SET inhalt=%inhalt:ü=a%
SET inhalt=%inhalt:ß=ss%
ECHO %inhalt%>>chinesen2.txt

works perfectly

Name: Anonymous 2009-05-17 10:43

>>4
tr "aieuo" "a" < file

Name: Anonymous 2009-05-17 10:46

>>16
cool batch file bro

Name: Anonymous 2009-05-17 10:56

>>16
found this solution
I lol'd. Enjoy your lack of reusability and modularity

Name: Anonymous 2009-05-17 11:08

Hey OP, use code tags and I'll take a look.

Name: Anonymous 2011-02-04 19:29

Name: Anonymous 2011-02-18 14:20

dubz

Name: Anonymous 2013-01-19 0:10

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List