Utility: match

Update! If fixed up all the greater-than and less-than symbols in this entry. I didn't make much sense before. I always forget to change those up in the HTML.
I'm just sharing a little utility I use all the time called match.

Usage: ./match [-h] <source_file> <uniq_file>

For each line in <source_file> print the index to the
first matching line in <uniq_file>.

[-h] Print results in 32 bit hexidecimal (default is decimal)

Note: The max line width supported is 4095 characters.
Note: Maximum number of lines supported is (2^32)
If I have a source file of data represented as text (as I often do because it's often easier for me to read binary dumps in a text editor than a special "hex editor"), I use match to create a table of indices to unique lines (often these correspond to 128 bits since that's the size of an SPU register).

I commonly use it like so (given I have a file called "source_file")
sort source_file | uniq > uniq_file
match source_file uniq_file
Now I have a handy table of indices!

Download: match.c