1、目的:希望拖入文本,自动删除多余的答案,只保留一个答案。
2、材料:
原文本:
Author: Serg Belyaev
###########
## .##@ #
# $ ...$ #
# $#*## #
# $. $ #
#### ####
###########
; Level 1
Title: level 1
Author: Serg Belyaev
Solution (pushes 38, moves 92, inlines 20, changes 14, steps 16 PMIS): rdLLLLullDRRRRRurDlllllllddrrRdrruLUdLLUUrRRRurrdLLLrrrddLUruLLrddLLdlUlluullddRRRllUluRRluR
Solution (pushes 42, moves 126, inlines 21, changes 12, steps 20 C): rdLLLLullDRRRRRurDlllllllddrrUdlluururrdLddlluRdrUUddRdrruLLLrrUdlluurRRRurrdLLrrddLLLdlUUdllulluRRluRdllddRRRdrUrrrruulDrdLLL
##########
## ###
# #.#$ ##
# *.. #
## #*#$ #
##$@ ###
## ###
##########
; Level 2
Title: level 2
Author: Serg Belyaev
Solution (pushes 24, moves 89, inlines 17, changes 14, steps 15 PMIS): dlUUURRRRllDuuurrDrDLLruullllDldRddrRuUdddrruUdLdlUlluuuurrrrdrdrdLuLLruullllddddrrrrUruL
Solution (pushes 26, moves 127, inlines 18, changes 11, steps 15 C): dlUUURRDullddrRuuuullDldRRlddrruUdddrruLdlUlluurrRRlllluurrrrDrDLLLrruullllddddrrrrUdlllluuuurrrrdrdLLrrrdLuluullllddddrrrrUruL
###########
###@ . ###
# #.#$ #
# *.* #
###$#.#$###
### $ #
#### # #
###########
; Level 3
Title: level 3
Author: Serg Belyaev
Solution (pushes 50, moves 154, inlines 27, changes 21, steps 23 PMIS): rrddddllUUddrrRRdrruLLLLuuRRDulluurrDDllLLddRdrUUUrrurrdLLLLddrRUdlluurRuullllDDRRUdddrruuLrddlluUllulldRRRRddllUdrrrrdrruLLLLuulLulldRRddRdrUrruuLrurrdLL
Solution (pushes 52, moves 218, inlines 28, changes 17, steps 28 C): rrddLLrrRRllddllUUddrrRRdrruLLLLuurrDullllddRdrUUdlluurRddrRdrruLLLLuullddRdrUlluurruurrDDDuuullddllddrrrRuuuullllDDuurrrrddddllUUUdddrruuLrddlluUllulldRRRRddllUdrruulLddrrrrdrruLLLLuullddRdrUlluuulldRRddrrrruuLrurrdLL
希望生成的文本:
Author: Serg Belyaev
###########
## .##@ #
# $ ...$ #
# $#*## #
# $. $ #
#### ####
###########
; Level 1
Title: level 1
Author: Serg Belyaev
Solution (pushes 38, moves 92, inlines 20, changes 14, steps 16 PMIS): rdLLLLullDRRRRRurDlllllllddrrRdrruLUdLLUUrRRRurrdLLLrrrddLUruLLrddLLdlUlluullddRRRllUluRRluR
##########
## ###
# #.#$ ##
# *.. #
## #*#$ #
##$@ ###
## ###
##########
; Level 2
Title: level 2
Author: Serg Belyaev
Solution (pushes 24, moves 89, inlines 17, changes 14, steps 15 PMIS): dlUUURRRRllDuuurrDrDLLruullllDldRddrRuUdddrruUdLdlUlluuuurrrrdrdrdLuLLruullllddddrrrrUruL
###########
###@ . ###
# #.#$ #
# *.* #
###$#.#$###
### $ #
#### # #
###########
; Level 3
Title: level 3
Author: Serg Belyaev
Solution (pushes 50, moves 154, inlines 27, changes 21, steps 23 PMIS): rrddddllUUddrrRRdrruLLLLuuRRDulluurrDDllLLddRdrUUUrrurrdLLLLddrRUdlluurRuullllDDRRUdddrruuLrddlluUllulldRRRRddllUdrrrrdrruLLLLuulLulldRRddRdrUrruuLrurrdLL
3、我的代码- @echo off
-
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in (%~nx1)do (
- set m=%%i
- if defined z (echo.)else echo !m!
- if "!m:~0,8!" == "Solution" (set z=%%i)else set z=
- )>>%~n1-2.txt
- endlocal
-
- pause
- goto:eof
复制代码 运行结果:
Author: Serg Belyaev
###########
## .##@ #
# $ ...$ #
# $#*## #
# $. $ #
#### ####
###########
Title: level 1
Author: Serg Belyaev
Solution (pushes 38, moves 92, inlines 20, changes 14, steps 16 PMIS): rdLLLLullDRRRRRurDlllllllddrrRdrruLUdLLUUrRRRurrdLLLrrrddLUruLLrddLLdlUlluullddRRRllUluRRluR
## ###
# #.#$ ##
# *.. #
## #*#$ #
##$@ ###
## ###
##########
Title: level 2
Author: Serg Belyaev
Solution (pushes 24, moves 89, inlines 17, changes 14, steps 15 PMIS): dlUUURRRRllDuuurrDrDLLruullllDldRddrRuUdddrruUdLdlUlluuuurrrrdrdrdLuLLruullllddddrrrrUruL
###@ . ###
# #.#$ #
# *.* #
###$#.#$###
### $ #
#### # #
###########
Title: level 3
Author: Serg Belyaev
Solution (pushes 50, moves 154, inlines 27, changes 21, steps 23 PMIS): rrddddllUUddrrRRdrruLLLLuuRRDulluurrDDllLLddRdrUUUrrurrdLLLLddrRUdlluurRuullllDDRRUdddrruuLrddlluUllulldRRRRddllUdrrrrdrruLLLLuulLulldRRddRdrUrruuLrurrdLL
每组第一行怎样都丢掉了?错在什么地方,请高手指教。谢谢! |