Grepper: Difference between revisions

From software
Jump to navigation Jump to search
Line 26: Line 26:
=Installation=
=Installation=
Program is a single c++ file that can be downloaded [http://popgen.dk/software/download/grepper.cpp]
Program is a single c++ file that can be downloaded [http://popgen.dk/software/download/grepper.cpp]
<pre>
wget http://popgen.dk/software/download/grepper.cpp
g++ grepper -O3 -o grepper -lz
</pre>

Revision as of 18:59, 15 March 2014

Small usefull command line program called grepper which is a usefull to complement POSIX grep.

The idea is that you have a file that can be 'whatever' delimited and then you want to extract entire rows, but you only want to do the search in specific columns.

  1. You supply a file containing all the keys that will be searched for in the datafile. The program will only do a single pass of the datafile.
  2. You specify which column to use for the search.

The program supports the following options which should make it somewhat similar to grep

  • -i don't care about cases (capital letter vs small letter)
  • -w seach for whole words
  • -v do complement

Brief overview

usage: grepper [OPTION] -k keyfile datafile.gz
usage: gunzip -c datafile.gz | grepper [OPTION] -k keyfile
options:
	-c [int]: which column to use for grepping (1 indexed)
	-d [char] delimitor for the datafile
	-w search for whole words (similar to grep -w option)
	-v complement grep (similar to grep -v option)
	-i ignore case (similar to grep -i option)

Installation

Program is a single c++ file that can be downloaded [1]

wget http://popgen.dk/software/download/grepper.cpp
g++ grepper -O3 -o grepper -lz