| 1. |
Solve : appending log files into a single file.? |
|
Answer» I have series of log files.I want to append all of them into a single file.I want the log file name to be appended before the log text.After appending,all the log files to be deleted. thanks .I also want to append the name of the log file before appending its contents. Code: [Select]@echo off set logfile=log.txt if exist "%logfile%" del "%logfile%" for /f "tokens=*" %%a in ('dir /b /s *.log') do ( echo **** %%a **** >> %logfile% type "%%a" >> "%logfile%" ) del *.log Thanks a lot.It worksQuote from: doslearner on September 18, 2008, 12:56:04 AM It works I know. Glad to help. Good luck! Happy New Year. I think my problem is somewhat similar to above. I will try to explain what exactly I want. I have some trend files in *.hst format which will generate everyday with that day's time & date stamp in file name & I have one tool which covert these *.Hst files in 2 text files with extensions *.txt & *.hdr. *.hdr file contains only headers of that data. exa. 3 Header1 Header2 Header3 In above exa. 3 MEANS no. of parameters & Header 1, 2, 3 are headers of data. *.txt file contains all data of that whole day with same 3 parameters. exa. Date Time Header1 Data Header2 Data Header3 Data I want to combine these 2 files in single excel file because again I want to use this excel file for report generation. I want to copy headers Header1, Header2, Header3 in first row & Column C, D & E respectively. In column A & B, I want to write 'Date' & 'Time' respectively because my *.txt file contain Date & time but header file not contain header for Date & Time. Then I want to copy all Data from *.txt file to excel file below respective header. I want to do this with a single click that's why I am trying to do this with run the batch file. By using below code we can replace *.txt file in *.XLS. Code: set dr=%systemdrive%\yourfolderpath&CLS for /f "tokens=1*" %%a in ('dir /a %dr% /b') do ( call copy "%dr%\%%a%%b" rename * *.EXL ) But I want to copy headers in first row of this *.xls file. Is It Possible? Waiting for Ur reply. |
|