Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

macosx workaround

  • Loading branch information...
commit b0930e9d741cc363449cfc9215a4502f7285877a 1 parent ec74628
David R. MacIver authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 bin/pearsons
View
16 bin/pearsons
@@ -8,15 +8,24 @@ do
esac
done
-DATAFILE=$(mktemp)
+DATAFILE=$(mktemp -t pearsons.XXXXXXXX)
cat > $DATAFILE
LINES=$(wc -l < $DATAFILE)
-TALLIED_IDENTS=$(mktemp)
+TALLIED_IDENTS=$(mktemp -t pearsons.XXXXXXXX)
SCRIPTS=$(dirname $0)
TALLY=$SCRIPTS/tally
+# The version of sed included in macosx by default is completely retarded.
+# While we still have a sed dependency we insist on using gsed on macosx.
+# Will be removing said sed dependency soon...
+case $(uname) in
+ Linux) SED='sed';;
+ Darwin) SED='gsed';;
+esac
+if [ -z "$(which ${SED})" ] ; then echo "NOT INSTALLED: ${SED}" >&2 ; exit 78 ; fi
+
# The entirety of java.io is synchronized. Synchronization costs will kill us
# if we let them. BiasedLocking makes uncontended synchronization cheap as hell
# but is by default off for a period of time around startup. Given that we are
@@ -25,6 +34,5 @@ TALLY=$SCRIPTS/tally
JAVA="java -XX:BiasedLockingStartupDelay=0 -Xmx256M -cp $SCRIPTS/../classes"
export LC_ALL=C
-cat $DATAFILE | sed "s/ /\n/g" | $TALLY | awk '{print $2, $1}' > $TALLIED_IDENTS
-awk '{print $1, $1, "01.00"}' < $TALLIED_IDENTS
+cat $DATAFILE | ${SED} "s/ /\n/g" | $TALLY | awk '{print $2, $1}' > $TALLIED_IDENTS
cat $DATAFILE | $JAVA cooccurrences | $TALLY | $JAVA pearsons $TALLIED_IDENTS $LINES $MIN_PEARSONS | awk '{ print $0; print $2, $1, $3 }'
Please sign in to comment.
Something went wrong with that request. Please try again.