Thanks
for %%x in (*.txt) do type %%x>>templist
(This assumes that a file named "templist" doesn't already exist.)
If there are spaces in any of the text files' names, use this instead:
for %%x in (*.txt) do type "%%x">>templist
--
You wanted to!
> On Oct 25, 10:11�am, "Auric__" <not.my.r...@email.address> wrote:
>> On Mon, 25 Oct 2010 15:05:46 GMT, Sam wrote:
>> > I get about 50 single text files, that are in the same format, each
>> > day. �They all need to be combined in to one text file to be
>> > processed. �Is there a way using a batch file to combine all these
>> > files? If so, could someone please provide a sample of the code?
>>
>> for %%x in (*.txt) do type %%x>>templist
>>
>> (This assumes that a file named "templist" doesn't already exist.)
>>
>> If there are spaces in any of the text files' names, use this instead:
>>
>> for %%x in (*.txt) do type "%%x">>templist
> Ok, so I tried that with a folder with 29 files in it. For some
> reason it duplicated records and gave me 59 records in the new file.
> Any suggestions?
(Please don't top-post.)
That's... odd. It works fine for me. Did you replace "templist" with
something that ends in ".txt"? "templist" *should not* end with ".txt" until
*after* the "for" line.
It looks like you're using Windows 7. I have zero experience with anything
newer than XP, and don't really know what's going on. You can try digging
through the FAQ here:
http://www.netikka.net/tsneti/info/tscmd.php
...or you can wait for someone who knows more than me to answer.
--
If swimming is so good for the figure, how do you explain whales?
>>> for %%x in (*.txt) do type "%%x">>templist
>
>> Ok, so I tried that with a folder with 29 files in it. For some
>> reason it duplicated records and gave me 59 records in the new file.
>> Any suggestions?
>
> That's... odd. It works fine for me. Did you replace "templist" with
> something that ends in ".txt"? "templist" *should not* end with ".txt" until
> *after* the "for" line.
I suspect that is the issue too.
Another method in NT flavour Windows that should work is
copy *.txt temp.tmp
ren temp.tmp "Complete list.txt"
--
Regards,
Mic
On Oct 25, 11:01 am, foxidrive <foxidr...@gotcha.woohoo.invalid>
wrote:
> > Mic- Hide quoted text -
>
> - Show quoted text -
Yes there is, and it is a frequently asked question.
Timo Salmi posted the FAQ list in the last couple of days -
Subject: Batch file information and FAQs
so have a look there.
--
Regards,
Mic
@echo off
copy *.txt file.doc
@echo off
for %%a in (*.txt) do type %%a >>file.doc
You can end up with this in the file
===[paste]===
Last line of file oneFirst line of file two
===[paste]===
I found out that when using MORE it eliminates this issue
@echo off
for %%a in (*.txt) do more %%a >>file.doc
and then you'll get this if the last line has a trailing CR or not.
===[paste]===
Last line of file one
First line of file two
===[paste]===
Thanks. I adapted the example to elaborate
How do I test and ensure that <CR><LF> is the last character pair of
my log file?
http://www.netikka.net/tsneti/info/tscmd163.htm
All the best, Timo
--
Prof. Timo Salmi mailto:t...@uwasa.fi ftp & http://garbo.uwasa.fi/
Hpage: http://www.uwasa.fi/laskentatoimi/english/personnel/salmitimo/
Department of Accounting and Finance, University of Vaasa, Finland
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.php
Thanks for the Help!
On Oct 26, 8:40 am, Timo Salmi <t...@uwasa.fi> wrote:
> On 25.10.2010 20:46 foxidrive wrote:
>
> > ===[paste]===
> > Last line of file oneFirst line of file two
> > ===[paste]===
>
> > I found out that when using MORE it eliminates this issue
>
> > @echo off
> > for %%a in (*.txt) do more %%a >>file.doc
>
> Thanks. I adapted the example to elaborate
>
> How do I test and ensure that <CR><LF> is the last character pair of
> my log file?
> http://www.netikka.net/tsneti/info/tscmd163.htm
>
> All the best, Timo
>
> --
> Prof. Timo Salmi mailto:t...@uwasa.fi ftp &http://garbo.uwasa.fi/
So tail +2 ape.txt prints from line 2
Append that output to your output file and thats it.
something like:
del *.tmp
for %p in (*.txt) do tail +2 %p >>myoutput.tmp
ren myoutput.tmp myoutput.txt
In XP+ versions of Windows the more command has a switch to start at an
offset too.
@echo off
for %%a in (*.txt) do more +1 %%a >>file.doc
--
Regards,
Mic
This will remove the string (Your Header) from a text file...
findstr /v "Your Header" Old.txt>New.txt
This is not diicult at all. Put all the txt files into 1 directory. Than do
this Copy *.txt :c\> D (whereas D is a directory or file you DON'T have
under C:\> whereas D is just an example)
Now, use your wordprocessor, and open up D..... and you'll find all the
files you had copied as 1 file. They merged into 1 file. Use the
wordprocessor to place them into the right sequence. Ready, done.
Good luck.
Cor