1.

Solve : COPY SPECIFIC CONTENTS OF ONE FILE TO ANOTHER FILE..???

Answer»

How can i copy some specific contents from ONE .txt file to another .txt file, but in a certain way though..
in the .txt file there is some text above this dashed line and some TIME-stamps below it like this..
Code: [Select]text above dashed line
----------------------------
time-stamps
time-stamps

so all i want to do is copy the time stamps under the dashed line to another .txt file SOMEWHERE else
is there any way at all to do this with batch commands..??Do the time stamps always start on the third line? If so, you could use the for command with the skip parameter.

You might also use the for command and count lines, copying the output when the count gets to three.

You might also use the findstr command with a regular expression if the text above the line has no numerics and the text below the line does.

Without seeing at least a snippet of actual data, we can only guess at what solution may work.

the time-stamps always start on the 10TH line in the .txt file
so how would i code a bat file to copy everything from the 10th line down into a new txt file..??In keeping with the KISS method of batch coding, for your consideration:

Code: [Select]@echo off
if exist out.txt del out.txt
for /f "skip=9 tokens=* delims=" %%i in (data.txt) do (
echo %%i >> out.txt
)

The file NAMES are negotiable, so feel free to change them.



Discussion

No Comment Found