暮雨潇潇 当前离线
列兵
qixiaobin0715 当前在线
大校
@echo off setlocal enabledelayedexpansion for /f "tokens=1* delims=: " %%i in ('type *.txt') do ( if "%%i"=="Number" ( set str=%%j ) else if "%%i"=="Sex" ( echo,!str! %%j>>New.txt ) )复制代码
TOP
hfxiang 当前在线
上尉
gawk -F"[ :]+" "/^Name/{a=$NF;while((getline)>0)if($1~/^Message/){next}else if($1~/^Sex$/)print a,$NF}" old.txt>new.txt复制代码