Dear David and Kaiser:
While the PDB format is (thankfully--to those used to it) around, it seems to me it is certainly a rather poor deterrent to the enjoyment of AWK:
For fixed-field format input, the designers of AWK suggested a useful solution: the function substr(s,p,n), i.e., "return substring of s of length n starting at position p" (Aho et al. The AWK Programming Language. Addison-Wesley, 1988, pp. 42, 43, 72).
The solution I've used, though, is to use gnu awk (gawk) with the format definition as follows:
BEGIN {FIELDWIDTHS="6 5 1 4 1 3 1 1 4 1 3 8 8 8 6 6 10 2 2";}
--hope you'd find that useful too.
As for Perl, somebody put it nicely that one should comment programs bearing in mind that the person reading them later is always a different one from the one who wrote them; that includes the programmer as she/he will always be in a different state of mind her/himself.
Best regards,
Navdeep
---
On Tue, Aug 06, 2013 at 08:07:22AM -0400, David A Case wrote:
>
> An awk script with /^ATOM/ as its selection is actually easier to write
> than the corresponding script for a PDB ATOM record, since the line can
> be split on white space.
On Mon, Aug 05, 2013 at 03:10:55AM -0700, kaiser wrote:
> Yes, using grep on mmcif files is "awk"ward (but petfectly possible); awk on the other hand works much better. It's actually more of a pain to use it on pdb files. And perl, well perl can handle anything and it will always look nice while you write it and never look nice when you look back at it...
---
Navdeep Sidhu
University of Goettingen
---
|