Daily Archives: 18 November 2011

Bash: head: Remove last N lines from file 4

head -n -$N inputFile > outputFile

Where $N is the number of the line from the end which you want to stop printing.
For example if you want to delete the last line you must issue the following:

head -n -1 inputFile > outputFile

Ubuntu: How to compile PrecoSAT v.570 under ubuntu 11.10

By downloading PrecoSAT from http://fmv.jku.at/precosat/ and trying to install it on Ubuntu 11.10 32-bit (Oneiric Ocelot) by:

    • Decompressing the files
    • and calling ./configure && make

I got the following error at make:

g++ -O3 -m32 -static -Wall -Wextra -DNDEBUG -DNLOGPRECO -DNSTATSPRECO  -c precomain.cc
In file included from precomain.cc:23:0:
precosat.hh:164:31: error: ‘ptrdiff_t’ has not been declared
precosat.hh:270:13: error: ‘ptrdiff_t’ has not been declared
make: *** [precomain.o] Error 1

which can be resolved by adding

#include <cstddef>

at the includes in the file precosat.hh