05-08 23:38:08.484 11404 11764 I Ads : GMA Debug CONTENT {"timestamp":1588961288491,"event":"onNetworkRequest","components":["network_request_36385a69-b99e-4da6-b6a0-7bf2a106a285"],"params":{"firstline":{"uri":"https://pubads.g.doubleclick.net/gampad/ads?submodel=SM-N915G&android_app_volume=1&disable_ml=false&format=interstitial_mb&omid_v=a.1.3.1-google_20200121&is_nonagon=true&android_app_muted=false&am=0&dv=21400&gl=GB&hl=en&js=afma-sdk-a-v201004999.14300000.1&lv=0&ms=CoACClZSVfMXCRQ-WNImS5Q9B8Kr7uHr8m5cVL4sU3c951ZafOWUx64ymtfyXUpdXg0A95gRozZwS4W6-w_RmoEeWxq56UkgzPcVmiNEL1Aa8-v6Cik5s15gGkF5AHJpfjwSOynwJ7ZEgj78CEI_AvDrK8pfF4OhctAnxYwxMmeZDX4zqP8dLptQ8EIZtjfmEtXjFS3lzvdrHUpgsG8E_EscYo0xlLZu7zzQe8GpDRUhnkQr4xGv4ou4ZqbLmstqeZdPLcZX1xROBq_rLfY_3cY7z8Tf8seqVNsTI49EG2HZuMjCLRFOmtinp3mFO8du9pxSg4cNV2JxjxFox1TGQ2QLqQqAAjorBHB9GJsXM85JwwKB2h9tQAvgPoaJZRwBhJQHB_qs2iswjcSsJldAYHKe105wq7VihcvZVM7oLDfQhQqWuQFYb27LCf9UH43etMBZvMq7aAOpKj5ilbFHdg13wiFIdsNlQ1Kv6saMKKSi4WPoScw1bW9WEqPrSuLZDwo6NN4iFo1cJ_2dD5Xu4R52ytmY70NkOeTVa07KGAVwR0GARwuRX6VTKtDAsWap6OybQAF9ZtCwbs5h8Man9xrlaxJRuuzzhH1KEnp3Nld-8JfXglPI4-8yOXRWjnB3fQadPz2BLEKiq-pUtZVrrRqIeQu5jDMjX69Oks3XSHwECN6D32ASENSnE_R_crSMn7XDhwnuK-4&mv=81983300.com.android.vending&rm=2&sp=false&coh=true&riv=11&u_sd=2.4&request_id=4145396e-4ada-4bd7-854a-11556ade0f70&render_in_browser=false&target_api=29&carrier=40407&is_sidewinder=false&seq_num=1&eid=318482080%2C318490406%2C318484496%2C318486317%2C318484676%2C318482960%2C318482459%2C318483611%2C318486978%2C318487060%2C318489974%2C318475417%2C318483742&tag_for_child_directed_treatment=0&_c_csdk_npa_o=false&_c_req_npa=false&npa=0&guci=0.0.0.0.0.0.0.0&rbv=1&u_w=640&u_h=383&msid=com.ea.gp.nbamobile&_package_name=com.ea.gp.nbamobile&an=44310.android.com.ea.gp.nbamobile&net=wi&u_audio=3&u_so=l&preqs_in_session=2&support_transparent_background=true&preqs=0&time_in_session=310380&output=html®ion=mobile_app&u_tz=330&url=44310.android.com.ea.gp.nbamobile.adsenseformobileapps.com&gdfp_req=1&markup=html&m_ast=afmajs&impl=ifr&iu=%2F220%2FNBALive%2FAndroid%2FRewarded_Video%2FDashboard&sz=480x320&oct_ist=1&correlator=1486806085148500&gsb=wi&lite=true&vfmt=18&vst=0&sdkv=o.201004999.14300000.1&sdki=3c4d&caps=inlineVideo_interactiveVideo_mraid1_mraid2_mraid3_sdkVideo_exo3_th_autoplay_mediation_scroll_av_transparentBackground_sdkAdmobApiForAds_di_sfv_dinm_dim_nav_navc_dinmo_ipdof_gls_gcache_xSeconds&bisch=true&blev=0.86&swdr=false&cans=5&canm=false&_mv=23.android&heap_free=9792968&heap_max=268435456&heap_total=38043632&wv_count=0&rdps=15650&blockAutoClicks=true&cust_params=excl_cat%26optout%3Dno%26coppa%3Dno&rewarded_version=1&includeDoritos=true&rdidl=36&idtypel=4&is_latl=-1&blob=ABPQqLGrcFoEjqzU1D-terFskdukGTLEuTUawcm0pBN0aB1d8YNSg6mLc5H5hWfITabn9X_sTUR-xainyvLxhx-QMpVlfZXee0FH8Z8Fjs6uM7kH5i5_Ej4OWZHYmzzc27g9uusoPfNAP_WRsabkoO4MOzGcL_wF_NLF8S72uFyd1TxihwAptei3UGc8midRCER_2m49ZCG92iIMZnSTLY3GHkm3yeGBDjP16FauKMJMYYX2n1MfK52OyblTrPquFX6adhiTApYLs-oIRLLuzbInS3P5cscrCxfBIHIkxOrqtg_fXXJTkgjUzk8Nhp3Tnm-4lN0lNRyzNnic-TU&et=125&tcar=194&jsv=sdk_20190107_RC02-canary-production-sdk_20200428_RC00&urll=2888#caps=inlineVideo_interactiveVideo_mraid1_mraid2_mraid3_sdkVideo_exo3_th_autoplay_mediation_scroll_av_transparentBackground_sdkAdmobApiForAds_di_sfv_dinm_dim_nav_navc_dinmo_ipdof_gls_gcache_xSeconds&eid=318482080%252C318490406%252C318484496%252C318486317%252C318484676%252C318482960%252C318482459%252C318483611%252C318486978%252C318487060%252C318489974%252C318475417%252C318483742&format=interstitial_mb&heap_free=9792968&heap_max=268435456&heap_total=38043632&js=afma-sdk-a-v201004999.14300000.1&msid=com.ea.gp.nbamobile&preqs=0&seq_num=1&target_api=29","verb":"GET"},"headers":[{"name":"User-Agent","value":"Mozilla/5.0 (Linux; Android 6.0.1; SM-N915G Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.138 Mobile Safari/537.36 (Mobile; afma-sdk-a-v201004999.14300000.1)"},{"name":"Cookie","value":"IDE=AHWqTUlALo2Mq3Qp52ZNNvAhzeqdzEJ0K5nNOV3OKMFW3vapCmqRNqnN6tIrx26A"}]}}
我希望输出的结果是这样的。tag_for_child_directed_treatment=0
,如果我输入 tag_for_child_directed_treatment
否则,如果打印完整的字符串就可以了。tag_for_child_directed_treatment=0
我已经尝试用代码。
@echo off
set /P search_string= Enter the string you would like to search for:
find "%search_string%" C:\Users\Bhargav\logcat1.txt
pause
它的输出是完整的一行,有人能帮我吗?
获取字符串。从开始到(包括)搜索字符串,提取数字。
@echo off
setlocal enabledelayedexpansion
set "search_string=tag_for_child_directed_treatment"
for /f "delims=" %%a in (test.txt) do set "string=%%a"
set "string=!string:*%search_string%=!"
for /f "delims==&" %%a in ("!string!") do set "result=%%a"
echo %search_string%=%result%
批量处理这样一个字符串是很可怕的。一个更可靠的解决方案是可以用 dbenham的效用 jrepl.bat它是一个混合型的JScriptbatch脚本,完全支持REGEX,这使得这个任务变得非常简单。
@echo off
set "search_string=tag_for_child_directed_treatment"
for /f "delims=" %%a in ('type test.txt ^| jrepl ".*tag_for_child_directed_treatment=([0-9]*).*" "$1" /XSEQ') do set "result=%%a"
echo %search_string%=%result%