Computing.Net > Forums > Windows XP > Batch file edit a sql script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file edit a sql script

Reply to Message Icon

Name: AlbitzT
Date: November 26, 2008 at 15:39:00 Pacific
OS: NA
CPU/Ram: NA
Product: NA
Comment:

Hi,

I have a script I am working on and could use some help. Their are about 200 lines in script and I only need about 150 of them. They all copy fine. It is one line that doesn't copy correctly.

to keep it short here is the line that isn't copying correctly:

create table JBPM_LOG (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, INDEX_ int null, DATE_ datetime null, TOKEN_ numeric(19,0) null, PARENT_ numeric(19,0) null, MESSAGE_ varchar(4000) null, EXCEPTION_ varchar(4000) null, ACTION_ numeric(19,0) null, NODE_ numeric(19,0) null, ENTER_ datetime null, LEAVE_ datetime null, DURATION_ numeric(19,0) null, NEWLONGVALUE_ numeric(19,0) null, TRANSITION_ numeric(19,0) null, CHILD_ numeric(19,0) null, SOURCENODE_ numeric(19,0) null, DESTINATIONNODE_ numeric(19,0) null, VARIABLEINSTANCE_ numeric(19,0) null, OLDBYTEARRAY_ numeric(19,0) null, NEWBYTEARRAY_ numeric(19,0) null, OLDDATEVALUE_ datetime null, NEWDATEVALUE_ datetime null, OLDDOUBLEVALUE_ double precision null, NEWDOUBLEVALUE_ double precision null, OLDLONGIDCLASS_ varchar(255) null, OLDLONGIDVALUE_ numeric(19,0) null, NEWLONGIDCLASS_ varchar(255) null, NEWLONGIDVALUE_ numeric(19,0) null, OLDSTRINGIDCLASS_ varchar(255) null, OLDSTRINGIDVALUE_ varchar(255) null, NEWSTRINGIDCLASS_ varchar(255) null, NEWSTRINGIDVALUE_ varchar(255) null, OLDLONGVALUE_ numeric(19,0) null, OLDSTRINGVALUE_ varchar(4000) null, NEWSTRINGVALUE_ varchar(4000) null, TASKINSTANCE_ numeric(19,0) null, TASKACTORID_ varchar(255) null, TASKOLDACTORID_ varchar(255) null, SWIMLANEINSTANCE_ numeric(19,0) null, primary key (ID_))

Yes that is all one line. The batch file I am using to move it to another file is:

@ECHO OFF
SET FILESRCH=orig.txt
SET OUTFILE=MOD_orig.txt
:PRECHECK
DEL /Q %OUTFILE%
GOTO CREATE
:CREATE
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (%FILESRCH%) do (
echo %%a | find "create">>%OUTFILE%
)
PAUSE
:eof

It work for all the lines except this one, it stops at "NEWSTRINGIDCLASS_ varchar(255) null, " that is the last part it copies, I don't know why it stops.

NOTE: This is the longest line in the script.

Good luck and thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: BatchFreak
Date: November 26, 2008 at 16:08:01 Pacific
Reply:

It could be over the CMD's limit, I forget what it is exactly but that line is VERY long, so it's possible

I only Batch if possible, 2000 more lines of code, oh well.


0

Response Number 2
Name: AlbitzT
Date: November 26, 2008 at 16:17:16 Pacific
Reply:

Thanks for your response.

Well it is only 1323 characters. Any ideas on possible work arounds?


0

Response Number 3
Name: aegis
Date: November 26, 2008 at 18:13:45 Pacific
Reply:

I don't have a workaround. But it looks to me like it quit in the area of 1024. That could possibly be the limit.


0

Response Number 4
Name: Mechanix2Go
Date: November 27, 2008 at 09:23:50 Pacific
Reply:

There may be more oing on with your bat than the bit you posted, but leaving out the unneed stuff:

===============================================
@echo off & setLocal EnableDelayedExpansion > newfile

for /f "tokens=* delims= " %%a in (myfile) do (
echo %%a | findstr "create" >> newfile
)
================================================

Or, far more simply:

findstr "create" < myfile > newfile


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 5
Name: AlbitzT
Date: November 28, 2008 at 13:30:56 Pacific
Reply:

It looks like that may just do the trick. I will test it later this afternoon and let you know. Thanks for your help either way.


0

Related Posts

See More



Response Number 6
Name: AlbitzT
Date: November 29, 2008 at 09:48:06 Pacific
Reply:

Worked like a charm. Thanks for your assitance.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Batch file edit a sql script

Executing a batch file www.computing.net/answers/windows-xp/executing-a-batch-file/103697.html

Batch File, Write Command? www.computing.net/answers/windows-xp/batch-file-write-command/47286.html

Batch File Parsing a text file www.computing.net/answers/windows-xp/batch-file-parsing-a-text-file-/151425.html