在基于文本的文本文件中批量移动行

时间:2019-05-29 00:54:40

标签: batch-file

我收到的数据记录器文件有一个文件输出。我想将基于字符串的行移动到多个文本文件。

我可以在下面的批处理文件中使用它,但是我想将其自动化,因为数据记录器发送的文本文件总是更改其名称(带有日期)

findstr TiltA HMA_input180529.txt >>output.txt

示例输入 csv( HMA_input180529.txt

2019-05-29 08:03:48,TiltA,3.420,19.9,0.5017,0.6903
2019-05-29 09:03:48,TiltB,3.420,19.9,0.3017,0.6903

示例输出 csv(TiltA.txt)

2019-05-29 08:03:48,TiltA,3.420,19.9,0.5017,0.6903

我不知道从哪里开始调用所有*.*文件,然后将新文本文件保存为与找到的字符串相同的名称,例如TiltA

1 个答案:

答案 0 :(得分:0)

您可以使用<label for="location">Location</label> <select id="location" class="filterby"> <option value="all">Show All</option> <option value="australia">Australia</option> <option value="singapore">Singapore</option> <option value="newzealand">New Zealand</option> <option value="usa">USA</option> <option value="uk">UK</option> <option value="vietnam">Vietnam</option> <option value="global">Global</option> <option value="othercountry">Other</option> </select> <label for="type">Type</label> <select id="type" class="filterby"> <option value="all">Show All</option> <option value="accommodation">Accommodation</option> <option value="app">App/Technology</option> <option value="business">Business</option> <option value="health">Health</option> <option value="hospitality">Hospitality</option> <option value="education">Education</option> <option value="retail">Retail</option> <option value="services">Services</option> <option value="travel">Travel</option> </select> <label for="code">Code</label> <select id="code" class="filterby"> <option value="all">Show All</option> <option value="001">001</option> <option value="002">002</option> <option value="003">003</option> <option value="004">004</option> </select> <hr> <div id="FilterContainer"> <div class="job-offer-card noresults noShow" data-options="all"> <p>no results</p> </div> <div class="job-offer-card" data-options="all vietnam accommodation travel 004"> <p>1 all vietnam accommodation travel _004</p> </div> <div class="job-offer-card" data-options="all vietnam travel _003"> <p>2 all vietnam travel _003</p> </div> <div class="job-offer-card" data-options="all vietnam accommodation travel"> <p>3 all vietnam accommodation travel</p> </div> <div class="job-offer-card" data-options="all australia accommodation travel 003"> <p>4 all australia accommodation travel 003</p> </div> <div class="job-offer-card" data-options="all australia education"> <p>5 all australia education</p> </div> <div class="job-offer-card" data-options="all vietnam newzealand usa accommodation"> <p>6 all vietnam newzealand usa accommodation</p> </div> <div class="job-offer-card" data-options="all vietnam accommodation travel"> <p>7 all vietnam accommodation travel</p> </div> <div class="job-offer-card" data-options="all vietnam travel"> <p>8 all vietnam travel</p> </div> <div class="job-offer-card" data-options="all vietnam accommodation travel"> <p>9 all vietnam accommodation travel</p> </div> <div class="job-offer-card" data-options="all australia accommodation travel"> <p>10 all australia accommodation travel</p> </div> <div class="job-offer-card" data-options="all australia health 001"> <p>11 all australia health _001</p> </div> <div class="job-offer-card" data-options="all vietnam accommodation 002"> <p>12 all vietnam accommodation _002</p> </div> </div>循环很容易地做到这一点。

FOR /F

这假设for %%f in (*.txt) do ( for /f "tokens=1-6 delims=," %%i in (%%f) do echo %%i,%%j,%%k,%%l,%%m,%%n>"%%j.txt" ) 的格式保持不变。

OR

token1,TITLE,token3,token4,token5,token6

这假设for %%f in (*.txt) do ( for /f "tokens=2 delims=," %%i in (%%f) do type %%f | find /i "%%i">"%%i.txt" ) 的格式保持不变。