PDA

View Full Version : XP Batch File



Arthur
12-Sep-2013, 17:21
Any XP Batch file people here?

I have 2 files - file1.txt and file2.txt.

File1.txt has multiple values on each line separated by commas and 500
lines.
File2.txt has a single value in each line and 500 lines.

I need a batch file that will read through file1 and file 2 at the same
time.

As it goes through file 1 and file 2 I need the values stored in a
variable -say A for file 1 and B for file 2.

Can anyone supply the code to read through both files at the same time?

Thanks in advance for any replies.

Jim Henderson
12-Sep-2013, 17:34
On Thu, 12 Sep 2013 16:21:10 +0000, Arthur wrote:

> Any XP Batch file people here?
>
> I have 2 files - file1.txt and file2.txt.
>
> File1.txt has multiple values on each line separated by commas and 500
> lines.
> File2.txt has a single value in each line and 500 lines.
>
> I need a batch file that will read through file1 and file 2 at the same
> time.
>
> As it goes through file 1 and file 2 I need the values stored in a
> variable -say A for file 1 and B for file 2.
>
> Can anyone supply the code to read through both files at the same time?
>
> Thanks in advance for any replies.

I wouldn't look to just batch file programming for this, but rather to
using whatever tool gets the job done.

Doing this in C, for example, would be pretty trivial. Or Python, Ruby,
Perl, ... - heck, even awk probably would handle it fine.

But we'd need to know what you need the values to be used for.

Jim
--
Jim Henderson, CNA6, CDE, CNI, LPIC-1, CLA10, CLP10
Novell/SUSE/NetIQ Knowledge Partner

Arthur
12-Sep-2013, 18:49
Thanks for your reply.
The data files contain the filename and keywords for image files.
The data that I want extracted will be passed to another utility to update
the properties of a large number of image files.



"Jim Henderson" <hendersj@no-mx.forums.novell.com> wrote in message
news:O2mYt.288$8v1.115@kovat.provo.novell.com...
> On Thu, 12 Sep 2013 16:21:10 +0000, Arthur wrote:
>
>> Any XP Batch file people here?
>>
>> I have 2 files - file1.txt and file2.txt.
>>
>> File1.txt has multiple values on each line separated by commas and 500
>> lines.
>> File2.txt has a single value in each line and 500 lines.
>>
>> I need a batch file that will read through file1 and file 2 at the same
>> time.
>>
>> As it goes through file 1 and file 2 I need the values stored in a
>> variable -say A for file 1 and B for file 2.
>>
>> Can anyone supply the code to read through both files at the same time?
>>
>> Thanks in advance for any replies.
>
> I wouldn't look to just batch file programming for this, but rather to
> using whatever tool gets the job done.
>
> Doing this in C, for example, would be pretty trivial. Or Python, Ruby,
> Perl, ... - heck, even awk probably would handle it fine.
>
> But we'd need to know what you need the values to be used for.
>
> Jim
> --
> Jim Henderson, CNA6, CDE, CNI, LPIC-1, CLA10, CLP10
> Novell/SUSE/NetIQ Knowledge Partner

Arthur
12-Sep-2013, 21:01
I think the problem is sorted. I have located some code on the web that I
should be able to modify to do the task I need done.


"Arthur" <a@b.com> wrote in message
news:89nYt.57$Xq1.38@kozak.provo.novell.com...
> Thanks for your reply.
> The data files contain the filename and keywords for image files.
> The data that I want extracted will be passed to another utility to update
> the properties of a large number of image files.
>
>
>
> "Jim Henderson" <hendersj@no-mx.forums.novell.com> wrote in message
> news:O2mYt.288$8v1.115@kovat.provo.novell.com...
>> On Thu, 12 Sep 2013 16:21:10 +0000, Arthur wrote:
>>
>>> Any XP Batch file people here?
>>>
>>> I have 2 files - file1.txt and file2.txt.
>>>
>>> File1.txt has multiple values on each line separated by commas and 500
>>> lines.
>>> File2.txt has a single value in each line and 500 lines.
>>>
>>> I need a batch file that will read through file1 and file 2 at the same
>>> time.
>>>
>>> As it goes through file 1 and file 2 I need the values stored in a
>>> variable -say A for file 1 and B for file 2.
>>>
>>> Can anyone supply the code to read through both files at the same time?
>>>
>>> Thanks in advance for any replies.
>>
>> I wouldn't look to just batch file programming for this, but rather to
>> using whatever tool gets the job done.
>>
>> Doing this in C, for example, would be pretty trivial. Or Python, Ruby,
>> Perl, ... - heck, even awk probably would handle it fine.
>>
>> But we'd need to know what you need the values to be used for.
>>
>> Jim
>> --
>> Jim Henderson, CNA6, CDE, CNI, LPIC-1, CLA10, CLP10
>> Novell/SUSE/NetIQ Knowledge Partner
>
>

Jim Henderson
13-Sep-2013, 00:04
On Thu, 12 Sep 2013 20:01:27 +0000, Arthur wrote:

> I think the problem is sorted. I have located some code on the web that
> I should be able to modify to do the task I need done.

That's cool. What I probably would've done is looked for a way to
extract the data using an awk script, and used that to generate a batch
file to accomplish the task.

Jim



--
Jim Henderson, CNA6, CDE, CNI, LPIC-1, CLA10, CLP10
Novell/SUSE/NetIQ Knowledge Partner