This (rarely updated page because I tend to forget it exists) is a collection of mostly unix-related tips & tricks I've come over on some page, news-message or through irc or some other channel, sometime or other.
% comm -12 <(sort fil1) <(sort fil2)
comm -12 <{sort fil1} <{sort fil2}
#!/usr/bin/perl
my %lines=();
my $filename1=shift;
my $filename2=shift;
open (FILE1, "<$filename1");
while (<FILE1>) {
$lines{$_}=1;
}
close(FILE1);
open (FILE2, "<$filename2");
while (<FILE2>) {
if (!$lines{$_}) {print;}
}
close(FILE1);
Use the package ISDN4BSD, it's available from ftp.consol.de/pub.
Log in as user isdn4bsd, using your email-address as the password.
Anonymous ftp will not work!
It must be statically linked. If you don't feel like testing destiny, use good old sh, which is quite usable after a set -o emacs.
Original file:
line1 line2 line3
With the GNU textutils tac:
% tac file line3 line2 line1
In vi(1) or vim(1):
:%g/^/m0 or :1;$g/^/m0 or :%g//m0
In vi(1) or vim(1) using the GNU textutils tac:
:%!tac or :1,3!tac
copyleft 1998-2004 taliesin
unless otherwise noted