如何用蝙蝠制作字典

时间:2022-01-29 00:15:14

I have a given file.I need to create a folder that has 27 files, the first file contains ordered alphabetically and unique words from the given file that start with a,the second that starts with b an so on.The 27-th file contains the words that start with other character.I managed to do my dictionary using awk,but i have to do it in bat and it's causing me a lot of problems.

我有一个给定的文件。我需要创建一个包含27个文件的文件夹,第一个文件包含按字母排序的字母和来自给定文件的以a开头的唯一单词,第二个文件以b开头,等等。第27个文件包含以其他字符开头的单词。我设法使用awk做我的字典,但我必须在蝙蝠中做它并且它导致了很多问题。

2 个解决方案

#1


0  

Note that you had NOT requested us to explain the Batch file, right? :-)

请注意,您没有要求我们解释批处理文件,对吧? :-)

@echo off
md folder
for /F "delims=" %%a in (theFile.txt) do (
   for %%b in (%%a) do (
      set word[%%b]=1
   )
)
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
   (for /F "tokens=2 delims=[]" %%b in ('set word[%%a') do (
       echo %%b
       set word[%%b]=
   )) > folder\%%a.txt 2>NUL
)
(for /F "tokens=2 delims=[]" %%b in ('set word[') do (
   echo %%b
   set word[%%b]=
)) > folder\other.txt

#2


0  

well technically I can think of many different ways you can do this but I would recommend doing something like this:

从技术上来说,我可以想到许多不同的方法可以做到这一点,但我建议做这样的事情:

@echo off
title dictionary
color 0a

echo enter the word you want for its definition.
echo.
set/p A=
if %A%==game GOTO game
ELSE
goto end
:end
Exit

:game
cls
echo.
echo game:a competitive activity involving skill, chance, or endurance on the part of two or more 
echo persons who play according to a set of rules, usually for their own amusement or for that of echo spectators.
echo.
pause
:end
Exit

And I'm just saying that this advice is coming from a teen!

而我只是说这个建议来自青少年!

#1


0  

Note that you had NOT requested us to explain the Batch file, right? :-)

请注意,您没有要求我们解释批处理文件,对吧? :-)

@echo off
md folder
for /F "delims=" %%a in (theFile.txt) do (
   for %%b in (%%a) do (
      set word[%%b]=1
   )
)
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
   (for /F "tokens=2 delims=[]" %%b in ('set word[%%a') do (
       echo %%b
       set word[%%b]=
   )) > folder\%%a.txt 2>NUL
)
(for /F "tokens=2 delims=[]" %%b in ('set word[') do (
   echo %%b
   set word[%%b]=
)) > folder\other.txt

#2


0  

well technically I can think of many different ways you can do this but I would recommend doing something like this:

从技术上来说,我可以想到许多不同的方法可以做到这一点,但我建议做这样的事情:

@echo off
title dictionary
color 0a

echo enter the word you want for its definition.
echo.
set/p A=
if %A%==game GOTO game
ELSE
goto end
:end
Exit

:game
cls
echo.
echo game:a competitive activity involving skill, chance, or endurance on the part of two or more 
echo persons who play according to a set of rules, usually for their own amusement or for that of echo spectators.
echo.
pause
:end
Exit

And I'm just saying that this advice is coming from a teen!

而我只是说这个建议来自青少年!