Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Credits 1,436 Posts 739 Joined 2007-10-11 17:44 18-year member UID 99469 Gender Male
Status Offline
Most friends here learn or come into contact with scripts to bring efficiency to life or work. This is also the purpose of most script developers. But if there is a better, quicker and more efficient method not used, and instead one settles for a second-best option, isn't that somewhat putting the cart before the horse?
Credits 2,278 Posts 1,020 Joined 2007-11-19 13:34 18-year member UID 103127 Gender Male
Status Offline
I learn it because it's fun and concise. Unlike other high-level languages that have classes and stuff, it's annoying. The compiled file for a simple task is nearly 1M. Also, it's very convenient, just need to use Notepad.
Credits 234 Posts 119 Joined 2007-04-22 11:09 19-year member UID 86077 Gender Male
Status Offline
@echo off
for /f "delims=" %%i in ('findstr /i "\.asp" a.txt') do (
set "var=%%i"
setlocal enabledelayedexpansion
set var=!var:"=!
set var=!var:#=!
set var=!var:"=!
set var=!var:^>=!
set var=!var:^<=!
set var=!var:/==!
set var=!var:.asp=#!
call :loop
endlocal
)
cd.>asp.txt
for /f "eol= delims=" %%i in (b.txt) do (
findstr /xc:"%%i" asp.txt >nul 2>nul||echo %%i>>asp.txt
)
del b.txt
start asp.txt
exit
:loop
for /f "delims=#" %%a in ("!var!") do call :lis "%%a"
goto :eof
:lis
for /f "tokens=1* delims==" %%a in ("%~1") do (
if not "%%b"=="" (call :lis "%%b") else >>b.txt echo %%a.asp
)
goto :eof
Thanks to the generous help from all brothers, the Internet is wonderful because of you.
I have added code to eliminate duplicate lines above, which realizes the function of eliminating duplicate lines. I don't know what method can be used to achieve the result of outputting a.asp|b.asp|c.asp...