Batch to match text file values

July 13, 2010 at 04:03:48
Specs: Windows XP
Hi guys,
I require script to read value from 1.txt and map that value to 2.txt and copy unique string to 3.txt
Content of
1.txt
00-24-2C-BB-E3-F2
2.txt
HOSTNAME,MAC,
HOSTA,02-80-37-EC-02-00,
HOSTB, 00-24-2C-BB-E3-F2,
HOSTC,02-80-37-EC-02-02,
3.txt
HOSTB, 00-24-2C-BB-E3-F2,

Thx for helping!


See More: Batch to match text file values

Report •


#1
July 13, 2010 at 04:14:35
Please note that this script will run on a bunch of XP machines and each XP machine will have it's own MAC address.

The MAC address needs to map to a file on a server. Match the MAC from local machine to the MAC in file on server.

Then it needs to copy that string containing the MAC address to another text file on local server.

Thx


Report •

#2
July 13, 2010 at 04:54:37
download GNU grep, then try this one liner

c:\> grep -f 1.txt 2.txt
HOSTB, 00-24-2C-BB-E3-F2,

GNU win32 packages | Gawk


Report •

#3
July 13, 2010 at 05:39:15
Hi thx for the reply.

But I have nailed it! :-)

FINDSTR /G:c:\SWD\MAC.txt c:\SWD\ANSWERFILE\ANSWERFILE.txt > C:\SWD\RESPONSE.txt

This is the string I have used to read the files and write to new file.

thx


Report •

Related Solutions


Ask Question