HollowWorks.com
About
Sketch Blog
Downloads*
  hexcat
  vimlike
  quickmblog
  leaves
  zephulor
  rads
  foomail
  onomatopoeia
Games
News
Photography


Donate towards my web hosting bill!
rads ::: Text parsing tool

License: GPL

* no screenshot *

rads-1.8.5.tar.gz ::: tar/gzipd file (source, man page, docs, configuration utilities) (48K)

MD5 (rads-1.8.5.tar.gz) = 2f77d2ba4ea158a0c591e12d5958950a

Description:
The new version is finally available!

This version uses the automake tools, and has a huge number of additional features. It also offers a great boost in performance.

For those who don't know, rads is a utility written to parse text records of an unknown length based upon a certain delimiters.

"Oh... Yes, that sounds like a very unixy geeky thing... I have no use for that you say." ... Well, you may be right, but if you happen to have to do unixy geeky things, this tool will come in very handy.

What can you do with it?

Let's say you have a database dump from MySQL, and one user needs their data from the dump, but doesn't need it imported back into MySQL. You can find an entire database entry from start to finish, out of a thousand, and redirect it out to a file as fast as the program can do it (Which is pretty fast).

You can find a single email in a 500 mb mail spool and output it entirely including headers, faster than it takes to load the spool in some uber fast mail reader like mutt.

If you have a log file you need to parse that includes entries of variable length and include lots of random linefeeds, rads can parse those entries assuming they have some unique delimiter. This is what rads was originally written for, to return full entries from a radius log file, but as noted above, there are plenty of other uses for it.


An example of usage.

Here is some example text:
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah fooblahbarsomeword
blah blah blah blah blah blah blah blah blah

blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah

blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
We will assume that this text is in a file called "file.txt".

With the default function of rads, you can find the entire paragraph that contains the word "fooblahbarsomeword" by typing this on the command line:
rads fooblahbarsomeword file.txt
This produces the following output:
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah fooblahbarsomeword
blah blah blah blah blah blah blah blah blah



 -- Found 1 records in file file --
Rads can be tweaked in a number of ways to alter the output, and can provide results quickly for very large files.

Revision History:
(2005.03.16)

Version 1.8.5, major bugfix.

There was a bug that caused rads to return the entire file if no delimiter was found. This has been resolved.

(2005.03.15)

Version 1.8.4, major bugfix.

There was a bug that caused rads to return "No records found" if the file searched was smaller than rads' buffer (512bytes). This has been fixed, apologies for any inconvenience.

(2005.03.11)

There have been a large number of internal revisions.

Version 1.8.3 is a complete re-write of the original program and includes a large number of functional changes. The help output has been included below because it best describes the features:

Usage: rads [-hiIlnqrtV] [--d=<delimiter>] <searchstring> <file1> <file2> <etc...>

-h Print this help.
-i Perform case insensitive search.
-I Perform case insensitive search for delimiters.
-r Turn on record separators.
-q Don't be verbose.
-l Do not print leading delimiter.
-t Do not print trailing delimiter.
-n Do not print leading or trailing delimiter.
-V Print version information and exit.

--d=<delimiter> Set the delimiter for records (Default is '\n\n')

(All single dash (-) options may be combined)

Certain special characters may be specified in both delimiter and search fields, and must be escaped. Supported characters are:

Carriage Return -- \r
Line Feed -- \n
Tab -- \t

In addition, if you wish to use \ it too must be escaped (\\).

Depending upon your shell environment, you may also have to escape your escapes -- i.e. \\n, \\t, \\ -- and enclose your term in quotes.

To search using two line feeds one tab and the letter h as your delimiter:

rads --d="\\n\\n\\th" <searchterm> <file1> <file2> <etc...>