On Fri, 2010-04-30 at 13:35 +0100, Nicholas Keep wrote: > If anyone has a piece of software that would do this it would be > great. >
How about this (this is a single line) --- grep 'ATOM\|HETATM' file1.pdb file2.pdb |grep -v REMARK | cut -d: -f 2 | cut -c 13-54 | sort | awk 'BEGIN {FIELDWIDTHS = "14 28"; pt=""} {if(pt== $1) print pr,$2; pt=$1; pr=$0;}' | awk 'BEGIN {FIELDWIDTHS = "14 4 8 8 8 5 8 8 8"} {printf "%s %8.4f\n",$1,sqrt(($3-$7)^2+($4-$8)^2+($5-$9)^2);}' | awk 'BEGIN {FIELDWIDTHS = "4 1 3 1 1 5 9"} {printf "%s %s %s %s %s\n", $3,$5,$6,$1,$7;}' --- The output is not sorted (sort isn't friendly to the idea of sorting alphabetically and numerically at the same time). And "awk" means "gawk" - "mawk" (Ubuntu default) doesn't allow fixed field selection which is key to dealing with files that have alternate conformers). HTH, Ed. -- "I'd sacrifice myself, but I'm too good at whistling." Julian, King of Lemurs