Search found 319 matches

by ghostmachine4
16 Mar 2011 22:17
Forum: DOS Batch Forum
Topic: file splitting
Replies: 16
Views: 15004

Re: file splitting

Hi Guys, Thanks for your help but I have run into a problem with the script. --- script --- @echo off &setlocal enabledelayedexpansion for /f "delims=" %%a in (combined.csv) do ( for /f "tokens=1,2 delims=," %%b in ("%%a") do ( if "%%b"=="DH" (s...
by ghostmachine4
16 Mar 2011 20:47
Forum: DOS Batch Forum
Topic: How to get a count of strings in a file
Replies: 4
Views: 5188

Re: How to get a count of strings in a file

Thank you ghost I am familiar with gawk, but this needs to be done using DOS only. you mean you cannot download gawk , right? Well, in that case, use vbscript (or powershell) unless you are saying you are working with DOS 6.22 ! Set objFS = CreateObject( "Scripting.FileSystemObject" ) str...
by ghostmachine4
16 Mar 2011 20:38
Forum: DOS Batch Forum
Topic: adding numbers in a file
Replies: 2
Views: 3773

Re: adding numbers in a file

Provided you are sure you don't have decimal numbers to add, otherwise, use a better programming tool, such as vbscript (or others ) because batch does not do decimals/floats. Set objFS = CreateObject( "Scripting.FileSystemObject" ) strFolder = WScript.Arguments(0) Set objFolder = objFS.Ge...
by ghostmachine4
16 Mar 2011 20:09
Forum: DOS Batch Forum
Topic: Need help locating a line in text file and replacing it
Replies: 9
Views: 8580

Re: Need help locating a line in text file and replacing it

Gosh, forget about batch for parsing files , even for anything!. It only has very primitive string manipulation capabilities, does not do decimal maths, has ugly syntax making maintenance and debugging difficult, slow to execute etc. If you can't use a good programming language, use the next best th...
by ghostmachine4
16 Mar 2011 19:38
Forum: DOS Batch Forum
Topic: How to get a count of strings in a file
Replies: 4
Views: 5188

Re: How to get a count of strings in a file

I have a text file the file looks like this. Hello world this is the first string Hello world this is the second string Hello world this is the third string World this is not enough strings I want to get a count on how many times the sub string World occurs in the file. The output should look like ...
by ghostmachine4
19 Jan 2011 21:47
Forum: DOS Batch Forum
Topic: BatchSubstitute Maximum Input/Output
Replies: 8
Views: 8160

Re: BatchSubstitute Maximum Input/Output

JDV wrote:Any help is appreciated, Thanks.

people should stop using batch to do things like file processing (and others), especially if its XML or HTML. Use a programming language with XML/HTML facilities, ( or at least with regular expression support + string manipulation functions )
by ghostmachine4
19 Jan 2011 21:44
Forum: DOS Batch Forum
Topic: [SOLVED]I need a function that deletes a single line in a...
Replies: 13
Views: 12266

Re: [SOLVED]I need a function that deletes a single line in

Hey, don't worry. The lines of my document doesn't will begin with "]". They will begin with " , any problems? --- EDITED --- I tested and had no problem starting the lines with " . only if you are ABSOLUTELY certain that in the future, things will remain the same. Otherwise, yo...
by ghostmachine4
19 Jan 2011 03:41
Forum: DOS Batch Forum
Topic: [SOLVED]I need a function that deletes a single line in a...
Replies: 13
Views: 12266

Re: I need a function that deletes a single line in a text f

I wouldn't want to use it if my lines ever were to unknowingly contain a beginning "[". leading "[" supported, only leading "]" stripped from line doesn't matter, either way, its a "defect" or a "limitation" of the batch. i sure hope OP doesn't have...
by ghostmachine4
18 Jan 2011 20:12
Forum: DOS Batch Forum
Topic: [SOLVED]I need a function that deletes a single line in a...
Replies: 13
Views: 12266

Re: I need a function that deletes a single line in a text f

via native CMD, text lines must not begin with "]" still, this is a "defect" in a software product. I wouldn't want to use it if my lines ever were to unknowingly contain a beginning "[". A better way, is to set a counter, then iterate the file using the for loop as us...
by ghostmachine4
18 Jan 2011 20:07
Forum: DOS Batch Forum
Topic: Simple SMTP Batch Script
Replies: 4
Views: 9903

Re: Simple SMTP Batch Script

the windows telnet client is not suited for scripting. Simple as that. Use an email client like blat as suggested. Or you could use a programming language with socket programming.
by ghostmachine4
13 Jan 2011 18:25
Forum: DOS Batch Forum
Topic: Search last column in a row
Replies: 3
Views: 4218

Re: Search last column in a row

you can use gawk

Code: Select all

gawk -vFS= "{print $(NF)}" file
by ghostmachine4
09 Jan 2011 17:52
Forum: DOS Batch Forum
Topic: Referencing Bible Verses Individually
Replies: 14
Views: 11936

Re: Referencing Bible Verses Individually

mosquitochalkie wrote:This is the command line I used

C:\bible>gawk "/^[A-Z]/{s=$0;}/^[0-9]/{print s\".\"$0 }" file

where bible.txt is the name of the file I want to change.

mosquitochalkie

if bible.txt is the name of the file you want to change, then use bible.txt, not "file".
by ghostmachine4
09 Jan 2011 10:12
Forum: DOS Batch Forum
Topic: Referencing Bible Verses Individually
Replies: 14
Views: 11936

Re: Referencing Bible Verses Individually

mosquitochalkie wrote:To ghostmachine4,
I have now tested your gawk code after downloading and installing gawk and the only output I get is a file named gawk which has no extension and a file size of zero.

that's definitely not correct. show me how you run the code.
by ghostmachine4
09 Jan 2011 06:05
Forum: DOS Batch Forum
Topic: Referencing Bible Verses Individually
Replies: 14
Views: 11936

Re: Referencing Bible Verses Individually

so you have provided another set of examples, now i need to see the output that you expect to see from those samples.
by ghostmachine4
08 Jan 2011 09:49
Forum: DOS Batch Forum
Topic: Referencing Bible Verses Individually
Replies: 14
Views: 11936

Re: Referencing Bible Verses Individually

then you will have to provide a more concrete example of your verses...I am only working with your provided sample...I am not a psychic to know what exactly is the format of your text.