![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-05 06:32 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] File operations |
| Printable Version 707 / 4 |
| Floor1 enliang | Posted 2007-04-14 05:27 |
| 初级用户 Posts 24 Credits 62 | |
|
In one directory there are the following files:
abc.ncmm_0 abc.ncmm_1 abc.ncmm_2 abc.ncmm_3 abc.ncmm_4 abc.ncmm_5 I wrote a piece of code to display the specified content in each file: @echo off for /f "delims=" %%i in ('dir /b /on *ncmm*') do ( for /f "delims=!" %%a in ('findstr ! %%i') do ( echo %%a ) ) pause The displayed content is as follows: <td width=83 align=center rowspan=2>IN102</td> < <td width=83 align=center rowspan=2>IN103</td> < <td width=83 align=center rowspan=2>IN104</td> < <td width=83 align=center rowspan=2>IN105</td> < <td width=83 align=center rowspan=2>IN105</td> < <td width=83 align=center rowspan=2>IN106</td> < There are two IN105 entries. Now I want to delete the file abc.ncmm_3 corresponding to the first IN105, and then merge the remaining files. What exactly should I do? Thanks. |
|
| Floor2 lxmxn | Posted 2007-04-14 13:57 |
| 版主 Posts 4,938 Credits 11,386 | |
| Floor3 enliang | Posted 2007-04-14 21:23 |
| 初级用户 Posts 24 Credits 62 | |
|
I didn't explain it clearly. The situation is like this: these ncmm files are output by another program. The number of files is random, maybe three or five, maybe dozens. The numeric suffixes of files whose specified content is duplicated are consecutive. It could be 1 2 3, or it could be 8 9, but there will never be a case like 2 and 4 having the same content (if that happens, then 2 3 4 would all have the same content).
|
|
| Floor4 lxmxn | Posted 2007-04-15 00:09 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Oh, my understanding was a bit off too.
One more question: do you want to merge the filtered files, or merge the original files? |
|
| Floor5 enliang | Posted 2007-04-15 01:01 |
| 初级用户 Posts 24 Credits 62 | |
|
Merge the filtered files
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |