You are not logged in.

#1 19 May 2007 19:26

Fen_Li
Member
From: Malang, Indonesia
Registered: 04 May 2007
Posts: 22
Website

Find "string" based on database file

Pease Help me...
I want to find "string" based on database file(*.db) or txtfile.

example .dbfile :
A34DC2 : File1
C234FF  : File2
C334eF  : File3
etc..

assumption : name of file with ID:a34dc2 is File1

like a crc32 searchmethod..
Q: how about it's code ?


G-Smart thing Smart

Offline

#2 25 May 2007 15:20

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: Find "string" based on database file

I'm guessing this is the sort of thing you're after:
** UNTESTED **

@echo off

set file=%~nx1
set data=data.txt

set match=

for /f "usebackq tokens=1* delims=: " %%a in ("%data%") do if /i "%%~b" EQU "%file%" set match=%%~a

if defined match (echo:CRC = %match%) ELSE (echo:No match for %file%)

What you'd do is save the above as a .cmd file and run it with a file name as a parameter.
IE:  crcfind.cmd  File1

Last edited by bluesxman (25 May 2007 15:20)


cmd | *sh | ruby | chef

Offline

#3 31 May 2007 18:11

Fen_Li
Member
From: Malang, Indonesia
Registered: 04 May 2007
Posts: 22
Website

Re: Find "string" based on database file

Thanks bluesxman..
but I have new Q: how to get crc of file using batch command (same as checksum in vb)
I'am sorry if my question is very stupid..I just a newbie and I want to know more about BatScripting..:)


G-Smart thing Smart

Offline

#4 01 Jun 2007 11:42

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: Find "string" based on database file

There are no native commands with which to generate a CRC.  You'd have to use a third party app or dip into a more powerful language, such as VB.


cmd | *sh | ruby | chef

Offline

Board footer

Powered by