rawk: Project Web Hosting - Open Source Software

rawk

Users

Download rawk files

Project detail and discuss

Get support

Not what you're looking for?

SourceForge.net hosts over 100,000 Open Source projects. You may find what you're looking for by searching our site or using our Software Map.

You may also want to consider these similarly-categorized projects:

Project Information

About this project:

This is the rawk project ("rawk")
Ruby awk - an awk-like stream processor that uses Ruby commands instead of awk.
From the rawk help message (rawk -h):

Usage: rawk [options] [ruby-commands] [FILE(s)]
Like 'awk' but uses ruby commands.

rawk sets up automatic variables like awk, with some differences. Listed
below, with awk equivalents in parens:
line = Input line ($0).
f[] = Array of fields ($1-$n).
filename = Name of input file or "-" for stdin (FILENAME).
fs = Field separator as a string (FS).
fsrx = Field separator as a Regexp.
nr = Total number of input records read so far (NR).
fnr = Number of input records for current file (FNR).
nf = Number of fields in current record (NF).
sq = single quote (').
dq = double quote (").
map{} = user-available map for holding values.

Options:
-b, --begin cmd Run cmd at the beginning. Like awk's "BEGIN{...}".
-c, --csv Split input lines as a CSV (respects quotes)
-e, --end cmd Run cmd at the end. Like awk's "END{...}".
-f, --command-file filename Run commands from file
-F, --field-separator fs Field separator. Default is space.
-h, --help Show this message
-n, --numeric Attempt to convert fields to numeric objects
-v, --assign var=val Assign var to val

Additional functions:
format_csv VALUES... -- Converts the list of values into a CSV.
format VALUES -- Concats values as string with a space in between.

Examples:
rawk 'puts line if f[1] == "TRUE"' input.csv
cat input.log | rawk 'puts line if nf > 10'
rawk -c 'puts f[1]' input.csv
rawk -F "\t" 'puts format_csv( nr, f.values_at(0,4..nf-1) )' HotelsCom.tsv
rawk 'puts line if map[f[9]].nil?; map[f[9]] = true' cs.txt
rawk -b 'x=0' -e 'puts format "size = ", x' 'x=x+1' input.log

Developers

Join this project:

To join this project, please contact the project administrators of this project, as shown on the project summary page.

Get the source code:

Source code for this project may be available as downloads or through one of the SCM repositories used by the project, as accessible from the project develop page.

Update project web pages:

This page is the default project web page supplied by SourceForge.net. If you are a member of this project, you can deploy your own project web pages as per our site documentation.

If you are a web page developer interested in this project, please consider reaching out to the project admin (per the "Join this project" section, above) to offer your assistance.

Project Web Hosted by SourceForge.net

┬ęCopyright 1999-2009 - Geeknet, Inc., All Rights Reserved

About - Legal - Help