join txt-files
Moderator: DosItHelp
join txt-files
Hi,
I need some help. My problem is how can I join some txt-files in a easy way. For example:
one.txt + two.txt + three.txt. + ... + n.txt == together.txt
Is there a easy way to solve this task with a dos-batch?
I need some help. My problem is how can I join some txt-files in a easy way. For example:
one.txt + two.txt + three.txt. + ... + n.txt == together.txt
Is there a easy way to solve this task with a dos-batch?
Or, you can use the >>
You can use the Type command, and append the output to a text file, like:
REM Create a new output.txt file, with the contents of file0.txt
Type File0.txt > output.txt
REM Append the contents of File1.txt to output.txt
Type File1.txt >> output.txt
REM Append the contents of File2.txt to output.txt
Type File2.txt >> output.txt
I use this to write a log of the progress of the batch file. For example, any output from osql.exe goes to a temp file, which is then appended to output.txt. When I'm done, I delete the temp file:
TYPE JobHeader.txt > output.txt
TYPE JobSeparator.txt >> output.txt
ECHO running Test.sql...
ECHO osql -E -S %server_name% -d %database% -o out.txt -i "Test.sql"
osql -E -S %server_name% -d %database% -o out.txt -i "Test.sql"
TYPE out.txt >> output.txt
TYPE JobSeparator.txt >> output.txt
ECHO running Test2.sql...
ECHO osql -E -S %server_name% -d %database% -o out.txt -i "Test2.sql"
osql -E -S %server_name% -d %database% -o out.txt -i "Test2.sql"
TYPE out.txt >> output.txt
TYPE JobSeparator.txt >> output.txt
DEL out.txt
Regards,
Mike Sharp
REM Create a new output.txt file, with the contents of file0.txt
Type File0.txt > output.txt
REM Append the contents of File1.txt to output.txt
Type File1.txt >> output.txt
REM Append the contents of File2.txt to output.txt
Type File2.txt >> output.txt
I use this to write a log of the progress of the batch file. For example, any output from osql.exe goes to a temp file, which is then appended to output.txt. When I'm done, I delete the temp file:
TYPE JobHeader.txt > output.txt
TYPE JobSeparator.txt >> output.txt
ECHO running Test.sql...
ECHO osql -E -S %server_name% -d %database% -o out.txt -i "Test.sql"
osql -E -S %server_name% -d %database% -o out.txt -i "Test.sql"
TYPE out.txt >> output.txt
TYPE JobSeparator.txt >> output.txt
ECHO running Test2.sql...
ECHO osql -E -S %server_name% -d %database% -o out.txt -i "Test2.sql"
osql -E -S %server_name% -d %database% -o out.txt -i "Test2.sql"
TYPE out.txt >> output.txt
TYPE JobSeparator.txt >> output.txt
DEL out.txt
Regards,
Mike Sharp
-
- Posts: 6
- Joined: 17 Jun 2009 20:17
- Location: http://vietdzung.net
- Contact:
-
- Expert
- Posts: 80
- Joined: 04 Feb 2009 10:03
Assuming all the files you need to concatenate are in the same folder:
Or, you could type it 1000 times ... it's your choice!
Code: Select all
Set "Out=\Temp\Outfile.txt"
Echo > %Out%
For /F %%F in ( 'Dir /B Folder\Name*.ext' ) Do (
Copy %Out% + %%F %Out%
)
Or, you could type it 1000 times ... it's your choice!
hello
hello i am a portugese boy with 13 years old exactly i am here to help you.
first we have a image saying ola is the first text
then the second text
and finaly the third text
now let's go for the code
this is just examples you can put only 1.txt + 2.txt or another name but first you put cd Desktop and you create in the desktopfor beeing more easy to locate the files.
and the result is:
first we have a image saying ola is the first text
then the second text
and finaly the third text
now let's go for the code
Code: Select all
copy /b 1.txt + 2.txt + 3.txt = final.txt
this is just examples you can put only 1.txt + 2.txt or another name but first you put cd Desktop and you create in the desktopfor beeing more easy to locate the files.
and the result is: