vicodin 当前离线
列兵
评分人数
aloha20200628 当前离线
少校
@echo off & (for /f "delims=" %%a in (abc.txt) do ( set "s=%%a" &for /f %%x in ( 'powershell "$a='%%a' -replace '\D+(\d+)',',$1,';$a.split(',')|sort{[int]$_} -des" ' ) do (setlocal enabledelayedexpansion &for /f %%n in ( 'powershell "[int](%%x*0.925)" ') do set "s=!s:%%x=%%n!") echo,!s!&endlocal))>abc.new.txt pause&exit/b复制代码
TOP
wanghan519 当前离线
三级士官
cat a.txt | perl -pe 's/\d+/int($& * 0.925)/ge'复制代码
Five66 当前离线
上尉
ruby -Egbk -n -e "puts $_.gsub(/\d+/){|x| (x.to_i*0.925).to_i}" abc.txt >new_abc.txt复制代码
@echo off & (for /f "delims=" %%a in (abc.txt) do ( set "s=%%a" &for /f %%x in ('echo,"%%a"^|grep -o -E "[0-9]+"^|sort76 -n -r') do ( setlocal enabledelayedexpansion &for /f %%n in ( 'gawk "BEGIN{print(int(%%x*0.925))}" ') do set "s=!s:%%x=%%n!") echo,!s!&endlocal))>abc.new.txt pause&exit/b复制代码
2>1/* :: @echo off & type "abc.txt"|cscript /nologo /e:jscript "%~f0">"abc.new.txt" pause&exit/b */ ws=WSH.stdin; while (!ws.atendofstream) { s=ws.readline(), a=s.match(/\d+/g), a=a.sort(function(a,b){return b-a}); for (i=0,l=a.length; i<l; i++) { sn=Math.floor(a[i]*0.925), eval('r=/'+a[i]+'/gi;'), s=s.replace(r,sn); } WSH.echo(s); }复制代码
WHY 当前离线
上校
PowerShell "$s = (gc a.txt -ReadCount 0) -join \"`r`n\"; $s=[regex]::Replace($s, '[0-9]+', {[Math]::Floor(0.925*$args[0].Value)}); sc b.txt $s"复制代码
@if(0)==(0) echo off type a.txt | cscript //nologo //e:jscript "%~f0" > b.txt pause & exit/b @end var s = WSH.StdIn.ReadAll(); s = s.replace( /[0-9]+/g, function(s0){return Math.floor(0.925*s0);} ) WSH.Echo(s);复制代码
python -c "(r:=__import__('re')) and (s:=__import__('sys')) and (list(map(lambda x:print(r.sub('\\d+',lambda y:str(int(int(y.group())*0.925)),x),end=''),open(s.argv[1],'r',-1,'gbk'))))" abc.txt >new_abc.txt复制代码
@echo off &more +1 "%~f0">"_._"&python "_._">"abc.new.txt"&del/q "_._"&exit/b import re with open('abc.txt') as f: for l in f: for d in re.findall('\d+',l): l=l.replace(d, f'{int(int(d)*0.925)}', 1) print(l, end='')复制代码