Board logo

标题: [文本处理] for分割遇到超长字符串,怎么处理? [打印本页]

作者: 踏沙行    时间: 2018-9-14 18:55     标题: for分割遇到超长字符串,怎么处理?

本帖最后由 踏沙行 于 2018-9-14 18:56 编辑

想对e:\1.txt的内容,以双引号为依据进行分割,结果出错:
  1. 代码:
  2. for /f tokens^=1^,3^,5^,7^ delims^=^" %%a in (e:\1.txt) do echo,%%a%%b == %%c == %%d
  3. 执行结果为:
  4. echo 为关闭状态
  5. echo 为关闭状态
  6. echo 为关闭状态
  7. echo 为关闭状态
复制代码
附:1.txt内容如下:
  1. HKLM"   : "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009" Value : "Help" Data  : "3|The System performance object consists of counters that apply to more than one instance of a component processors on the computer. |5|The Memory performance object  consists of counters that describe the behavior of physical and virtual memory on the computer.  Physical memory is the amount of random access memory on the computer.  Virtual memory consists of the space in physical memory and on disk.  Many of the memory counters monitor paging, which is the movement of pages of code and data between disk and physical memory.  Excessive paging, a symptom of a memory shortage, can cause delays which interfere with all system processes.|7|% Processor Time is the percentage of elapsed time that the processor spends to execute a non-Idle thread. It is calculated by measuring the duration of the idle thread is active in the sample interval, and subtracting that time from interval duration.  (Each processor has an idle thread that consumes cycles when no other threads are ready to run). This counter is the primary indicator of processor activity, and displays the average percentage of busy time observed during the sample interval. It is calculated by monitoring the time that the service is inactive, and subtracting that value from 100%.|9|% Total DPC Time is the average percentage of time that all processors spend receiving and servicing deferred procedure calls (DPCs).  (DPCs are interrupts that run at a lower priority than the standard interrupts). It is the sum of Processor: % DPC Time for all processors on the computer, divided by the number of processors.  System: % Total DPC Time is a component of System: % Total Privileged Time because DPCs are executed in privileged mode.  DPCs are counted separately and are not a component of the interrupt count.  This counter displays the average busy time as a percentage of the sample time.|11|File Read Operations/sec is the combined rate of file system read requests to all devices on the computer, including requests to read from the file system cache.  It is measured in numbers of reads.  This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.  |13|File Write Operations/sec is the combined rate of the file system write requests to all devices on the computer, including requests to write to data in the file system cache.  It is measured in numbers of writes. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.|15|File Control Operations/sec is the combined rate of file system operations that are neither reads nor writes, such as file system control requests and requests for information about device characteristics or status.  This is the inverse of System: File Data Operations/sec and is measured in number of operations perf second.  This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval. |17|File Read Bytes/sec is the overall rate at which bytes are read to satisfy  file system read requests to all devices on the computer, including reads from the file system cache.  It is measured in number of bytes per second.  This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.  |19|File Write Bytes/sec is the overall rate at which bytes are written to satisfy file system write requests to all devices on the computer, including writes to the file system cache.  It is measured in number of bytes per second.  This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.  |21|File Control Bytes/sec is the overall rate at which bytes are transferred for all file system operations that are neither reads nor writes, including file system control requests and requests for information about device characteristics or status.  It is measured in numbers of bytes.  This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval. |23|% Total Interrupt Time is the average percentage of time that all processors spend receiving and servicing hardware interrupts during sample intervals, where the value is an indirect indicator of the activity of devices that generate interrupts. It is the sum of Processor: % Interrupt Time for of all processors on the computer, divided by the number of processors.  DPCs are counted separately and are not a component of the interrupt count.  This value is an indirect indicator of the activity of devices that generate interrupts, such as the system timer, the mouse, disk drivers, data communication lines, network interface cards and other peripheral devices. |25|Available Bytes is the amount of physical memory, in bytes, available to processes running on the computer.  It is calculated by adding the amount of space on the Zeroed, Free, and Standby memory lists. Free memory is ready for use; Zeroed memory consists of pages of memory filled with zeros to prevent subsequent processes from seeing data used by a previous process; Standby memory is memory that has been removed from a process' working set (its physical memory) on route to disk, but is still available to be recalled.  This counter displays the last observed value only; it is not an average. |27|Committed Bytes is the amount of committed virtual memory, in bytes. Committed memory is the physical memory which has space reserved on the disk paging file(s). There can be one or more paging files on each physical drive. This counter displays the last observed value only; it is not an average.|29|Page Faults/sec is the average number of pages faulted per second. It is measured in number of pages faulted per second because only one page is faulted in each fault operation, hence this is also equal to the number of page fault operations. This counter includes both hard faults (those that require disk access) and soft faults (where the faulted page is found elsewhere in physical memory.) Most processors can handle large numbers of soft faults without significant consequence. However, hard faults, which require disk access, can cause significant delays.|31|Commit Limit is the amount of virtual memory that can be committed without having to extend the paging file(s).  It is measured in bytes. Committed memory is the physical memory which has space reserved on the disk paging files. There can be one paging file on each logical drive). If the paging file(s) are be expanded, this limit increases accordingly.  This counter displays the last observed value only; it is not an average.|33|Write Copies/sec is the rate at which page faults are caused by attempts to write that have been satisfied by coping of the page from elsewhere in physical memory. This is an economical way of sharing data since pages are only copied when they are written to; otherwise, the page is shared. This counter shows the number of copies, without regard for the number of pages copied in each operation.|35|Transition Faults/sec is the rate at which page faults are resolved by recovering pages that were being used by another process sharing the page, or were on the modified page list or the standby list, or were being written to disk at the time of the page fault. The pages were recovered without additional disk activity. Transition faults are counted in numbers of faults; because only one page is faulted in each operation, it is also equal to the number of pages faulted.|37|Cache Faults/sec is the rate at which faults occur when a page sought in the file system cache is not found and must be retrieved from elsewhere in memory (a soft fault) or from disk (a hard fault). The file system cache is an area of physical memory that stores recently used pages of data for applications. Cache activity is a reliable indicator of most application I/O operations. This counter shows the number of faults, without regard for the number of pages faulted in each operation.|39|Demand Zero Faults/sec is the rate at which a zeroed page is required to satisfy the fault.  Zeroed pages, pages emptied of previously stored data and filled with zeros, are a security feature of Windows that prevent processes from seeing data stored by earlier processes that used the memory space. Windows maintains a list of zeroed pages to accelerate this process. This counter shows the number of faults, without regard to the number of pages retrieved to satisfy the fault. This counter displays the difference between the values observed in the last two samples, divided by the duration of the sample interval.|41|Pages/sec is the rate at which pages are read from or written to disk to resolve hard page faults. This counter is a primary indicator of the kinds of faults that cause system-wide delays.  It is the sum of Memory\\Pages Input/sec and Memory\\Pages Output/sec.  It is counted in numbers of pages, so it can be compared to other counts of pages, such as Memory\\Page Faults/sec, without conversion. It includes pages retrieved to satisfy faults in the file system cache (usually requested by applications) non-cached mapped memory files.|43|Page Reads/sec is the rate at which the disk was read to resolve hard page faults. It shows the number of reads operations, without regard to the  
  2. HKLM"   : "\SYSTEM\ControlSet002\Enum\Root\LEGACY_VSAPINT\0000" Value : "DeviceDesc" Data  : "Trend Micro VSAPI NT"
  3. HKLM"   : "\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_VSAPINT\0000" Value : "DeviceDesc" Data  : "Trend Micro VSAPI NT"
复制代码
【补充】因原文太长,发贴时提示字符超过长度,所以就删除了一些
作者: ai20110304    时间: 2018-9-16 21:44

回复 1# 踏沙行


    超出P一行处理的长度了吧。




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2