Copy with carriage return Batch files
Solved
ismail.bensikali
Posted messages
5
Status
Member
-
ismail.bensikali Posted messages 5 Status Member -
ismail.bensikali Posted messages 5 Status Member -
Hello,
I am looking to remove lines that start with "average" from the CSV files and write those lines into a results file; here is what I have found so far:
FOR %%i IN (0,1,9) DO (
@ set meth=%%i
FOR %%j IN (0,1,3) DO (
set it=%%j
findstr "^average" Methode_!meth!_!it!_PSNR.csv >> Resultat.csv
)
)
The result is in the form:
average 36.146590average 36.146590average 36.14659
The problem is that I want to have a result like this:
36.146590
36.146590
36.14659
that is, each result on a separate line; so I added echo.>>Resultat.csv after each iteration and it works well;
I was wondering is there another method to copy the lines and create a newline at the same time?
Thank you for your help.
I am looking to remove lines that start with "average" from the CSV files and write those lines into a results file; here is what I have found so far:
FOR %%i IN (0,1,9) DO (
@ set meth=%%i
FOR %%j IN (0,1,3) DO (
set it=%%j
findstr "^average" Methode_!meth!_!it!_PSNR.csv >> Resultat.csv
)
)
The result is in the form:
average 36.146590average 36.146590average 36.14659
The problem is that I want to have a result like this:
36.146590
36.146590
36.14659
that is, each result on a separate line; so I added echo.>>Resultat.csv after each iteration and it works well;
I was wondering is there another method to copy the lines and create a newline at the same time?
Thank you for your help.
3 answers
-
You can create a temporary file, to test:
(type Methode_!meth!_!it!_PSNR.csv & echo.) > %TMP%\fichierxxxx findstr "^average" %TMP%\fichierxxxx >> Resultat.csv
-
hello
if average is on the last line, there's no line break at the end of the line.
either do as you do, or add a line break to the csv files. -
Hello
Thank you dubcek for your reply, the problem is that the csv files containing the "average" values are generated automatically by another command (VQM.exe) and they have a standard format so I cannot modify them.
Thanks.