Search found 345 matches

by Samir
31 Oct 2015 14:57
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

But is there a way to just nest the command instead of using a file? No. What's the reason for that? Are you trying to skip a certain number of lines from the beginning? My thought is that >"!txt_out!" could be changed to this to achieve it >>"TOTLSOLD.TXT" Am I on the right tra...
by Samir
31 Oct 2015 14:41
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

OK, I guess that could be what you have in mind @echo off &setlocal set "txt_in=test.txt" set "txt_out=test2.txt" setlocal EnableDelayedExpansion <"!txt_in!" >"!txt_out!" ( for %%i in ( "Fuel:87" I have a couple of questions here. I can make a f...
by Samir
31 Oct 2015 14:23
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

In my original thinking, an array is the other data structure I was thinking to store the product/moniker table in and then somehow retrieve that. But updating the table if anything changes is still a chore--and it's a chore no matter what format we store the table in since it would have to be upda...
by Samir
31 Oct 2015 14:19
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

one odd thing ... is that General Merc is missing in the monikers That's exactly why I told you that it will be hard to become aware of those faults. Yeah, I just found the same thing. It's never easy to set up something like this, and can be difficult when things change, but the idea is to set thi...
by Samir
31 Oct 2015 13:32
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

As a general rule, the direct access to an array element is much faster than a FOR loop with individual tests, and is less affected by a large number of elements. In the program below the moniker array is hard-coded, but it would be more convenient to store it in a text file. The most difficult par...
by Samir
31 Oct 2015 13:24
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

It's worked quite well except for one odd thing that looks like it's happening when there's two lines in a row with 0 amount. It doesn't seem like this should be an issue because the loop test is quite simple. Here's the code I'm using and the test data file: @echo off &setlocal set "txt_in...
by Samir
31 Oct 2015 12:55
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

Bear in mind that the first code is much more robust. Every item will be part of the output as long as the quantity isn't 0. The product names for non-fuel are taken from the original list. For the second code you have to make sure that the number, the order, and the product names never change. The...
by Samir
31 Oct 2015 11:20
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

OK, I guess that could be what you have in mind @echo off &setlocal set "txt_in=test.txt" set "txt_out=test2.txt" setlocal EnableDelayedExpansion <"!txt_in!" >"!txt_out!" ( for %%i in ( "Fuel:87" "Fuel:89" "Fuel:93" "Fue...
by Samir
31 Oct 2015 11:19
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

The bottleneck is not the "if-else" cascade but the "call :label". The latter is needed to remove trailing spaces though. And - no - it isn't processed for each line because the check for "amount not 0" is placed beforehand. With that, a loop can be done just to take e...
by Samir
31 Oct 2015 10:21
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Re: Massaging Textual Data

That's the logic I was thinking of too, but the if else loop has to be processed on each line. It's varying the amount of time taken with the last product type taking the longest, but it still has to loop each time. So an idea that occurred to me before sleeping last night was that if each product i...
by Samir
30 Oct 2015 18:07
Forum: DOS Batch Forum
Topic: Massaging Textual Data
Replies: 27
Views: 3346

Massaging Textual Data

I have a text file with the following data: Unl-Self 669.878 1419.48 Ul-Plus-Self 42.943 97.43 Supreme-Self 128.648 349.79 Diesel-Self 19.100 44.30 Automotive 0 0.00 Beverage 0 0.00 Candy 5 5.21 Coffee 0 0.00 Coke Product 1 0.99 Cigarettes 0 0.00 Energy Drink 4 9.18 Fountain 2 2.18 Grocery 2 1.58 Ca...
by Samir
30 Oct 2015 17:33
Forum: DOS Batch Forum
Topic: Running Two Applications Simultaneously Using START /W
Replies: 20
Views: 3246

Re: Running Two Applications Simultaneously Using START /W

I don't see the benefit of using "start /W" when using pipes, especially if you want to keep it simple. The batch already waits all called threads to close before continuing with the next line. penpen I didn't realize it worked that way by default. Let me try it. Yep, you're absolutely ri...
by Samir
30 Oct 2015 17:29
Forum: DOS Batch Forum
Topic: Running Two Applications Simultaneously Using START /W
Replies: 20
Views: 3246

Re: Running Two Applications Simultaneously Using START /W

Squashman wrote:This seems to work as well.

Code: Select all

@echo off
start "" /wait cmd /c temp.bat |start "" /wait cmd /c temp2.bat

echo all done
pause
Ah, I like this too as it's a little easier to read. 8)
by Samir
30 Oct 2015 17:27
Forum: DOS Batch Forum
Topic: Iterating For The Last 60 Days
Replies: 8
Views: 1868

Re: Iterating For The Last 60 Days

Thank you so much gentleman! I didn't think about converting the date and then converting it back. Let me think on this idea. 8)
by Samir
30 Oct 2015 13:34
Forum: DOS Batch Forum
Topic: Iterating For The Last 60 Days
Replies: 8
Views: 1868

Re: Iterating For The Last 60 Days

I would just use Dave's GetTimeStamp.bat C:\BatchFiles\JGetTimeStamp>getTimeStamp -d '10-30-2015' -od -60 -f {yyyy}{mm}{dd} 20150831 But this is hybrid. I want to do it in pure batch. The ideas I've come up with so far involves decrementing the date using set and then looping. But addressing the mo...