PC Review


Reply
Thread Tools Rate Thread

Batch scripting

 
 
=?Utf-8?B?R2Fsb3A=?=
Guest
Posts: n/a
 
      19th Sep 2006
I have an automated process produces many *.txt files in a specific folder.
It is continuos text which runs to 20 to 30 pages without page break. I want
a utility that I can run throgh batch process to insert a page break before
the word "Hello". So that every page is started fresh wherever it has "Hello"
word.
Any ideas to accomplish this task?
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      20th Sep 2006

"Galop" <(E-Mail Removed)> wrote in message
news:8F9FE517-433D-4340-918B-(E-Mail Removed)...
> I have an automated process produces many *.txt files in a specific

folder.
> It is continuos text which runs to 20 to 30 pages without page break. I

want
> a utility that I can run throgh batch process to insert a page break

before
> the word "Hello". So that every page is started fresh wherever it has

"Hello"
> word.
> Any ideas to accomplish this task?


You could use this batch file:
@echo off
for /F "tokens=*" %%* in ('type test.txt') do (
echo %%* | find /i "Hello" > nul && echo.>>test1.txt
echo %%* >> test1.txt
)

It has some restrictions:
- I expect it to take some time to run through 30 pages.
- It will trip over so-called "poison characters" such as
>, <, &, ^, |.

A better way might be to use Google to look for a Command
Line text editor.


 
Reply With Quote
 
Marco Pesce
Guest
Posts: n/a
 
      20th Sep 2006
On Wed, 20 Sep 2006 09:19:00 +1000 "Pegasus \(MVP\)" <(E-Mail Removed)>
said:

>
>You could use this batch file:
>@echo off
>for /F "tokens=*" %%* in ('type test.txt') do (
> echo %%* | find /i "Hello" > nul && echo.>>test1.txt
> echo %%* >> test1.txt
>)


Hi

I was wondering: in %%* , is * used as a normal variable or does it
have a particular "wildcard" meaning, related to "tokens=*" ?

I noticed the first part of the script

for /F "tokens=*" %%* in ('type test.txt') do echo %%*

seems to work the same way when using %%i as variable

e.g.

for /F "tokens=*" %%i in ('type test.txt') do echo %%i

Thank you

__

Marco Pesce - e-mail: marcopesce#tin.it
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      20th Sep 2006

"Marco Pesce" <marcopesce@tin..it> wrote in message
news:(E-Mail Removed)...
> On Wed, 20 Sep 2006 09:19:00 +1000 "Pegasus \(MVP\)" <(E-Mail Removed)>
> said:
>
> >
> >You could use this batch file:
> >@echo off
> >for /F "tokens=*" %%* in ('type test.txt') do (
> > echo %%* | find /i "Hello" > nul && echo.>>test1.txt
> > echo %%* >> test1.txt
> >)

>
> Hi
>
> I was wondering: in %%* , is * used as a normal variable or does it
> have a particular "wildcard" meaning, related to "tokens=*" ?
>
> I noticed the first part of the script
>
> for /F "tokens=*" %%* in ('type test.txt') do echo %%*
>
> seems to work the same way when using %%i as variable
>
> e.g.
>
> for /F "tokens=*" %%i in ('type test.txt') do echo %%i
>
> Thank you


%%i will grab only the first token on the line (usually the first word).
%%* will grab the whole lot.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch scripting: If statement Slickuser Windows XP Help 1 11th Oct 2009 10:15 AM
Batch scripting =?Utf-8?B?SGFtaWQgT3phaXI=?= Windows XP General 3 26th Jul 2006 10:15 PM
Batch Language vs VB Scripting... SP Goodman Windows XP Customization 10 7th Jun 2006 06:29 PM
ANN: Batch Scripting Toolkit 2.0 Bill Stewart Microsoft Windows 2000 CMD Promt 1 5th Apr 2006 10:38 PM
ANN: Batch Scripting Toolkit 1.0 Bill Stewart Microsoft Windows 2000 CMD Promt 0 15th Apr 2004 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:24 PM.