Commit 18b476a9 authored by bbguimaraes's avatar bbguimaraes
Browse files

Added auxiliary scripts.

These are miscellaneous scripts to work with the files used and produced
by latex and weka.
parent 0b710068
#!/usr/bin/perl -w
# Looks for unique citations, showing a count besides each.
local $/;
local $, = "\n";
local $\ = "\n";
$re_citation = qr/\\cite{(\w+)}/;
open(SORT, "| sort | uniq -c");
for(<>) {
print SORT m/$re_citation/g;
}
close(SORT);
#!/bin/sh
# Find best result (by percent correct) in a file by dataset.
set -e
tmp=`getopt -o f: -- "$@"` || exit $?
eval set -- "$tmp"
while true; do
case "$1" in
-f) input_file="$2"; shift 2 ;;
--) shift; break ;;
esac
done
dataset="$1"
if [ "$#" -lt 1 ]; then
echo "Usage: $0 [ -f input_file ] dataset [ sort_options... ]" >&2
exit 1
fi
shift
ordering="${@:--k 13,13n}"
[ "$input_file" ] && exec < "$input_file"
cat \
| grep "^$dataset" \
| sort -t , $ordering \
| tail -1
#!/bin/sh
# Displays the results in a table, sorted by dataset and percent correct.
[ "$1" ] && exec < "$1"
fields=1,2,3,4,14,58
(
echo -n 'Line,'
head -n 1 | cut -d , -f "${fields}"
cat -n \
| sed 's/^\s*\([0-9]\+\)\s*/\1,/' \
| cut -d , -f "${fields}" \
| sort -t , -k 2,2 -k 5,5n \
| sed "s/'Selected values: \(.*\)\\\n'/\1/"
) | column -ts ,
#!/bin/bash
# Displays specific columns of a results file.
if [ "$#" -ne 1 ]; then
echo "Usage: $0 file column,column..." >&2
exit 1
fi
if [ "$2" ]; then
exec < "$1"
shift
fi
cut -d , -f "$1" | column -ts ,
#!/bin/sh
# Displays the indices of the items on the header of the results files.
[ "$1" ] && exec < "$1"
head -n 1 | tr , '\n' | cat -n
#!/bin/bash
# Displays a specific row on a results file.
if [ "$#" -ne 2 ]; then
echo "Usage: $0 file row" >&2
exit 1
fi
paste \
<(head "$1" | head -1 | tr , '\n') \
<(sed -n "$2p" "$1" | tr , '\n') | column -ts "$(printf '\t')"
#!/usr/bin/perl
# Displays the title for each entry on bibtex file.
use warnings;
use strict;
local $/;
local $, = "\n";
my @entries = <> =~ m/\@\w+\{([^}]+)\}/mgc;
my @titles = map { m/title\s*= "([^":]+)/; $1 } @entries;
print @titles;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment