#!/usr/bin/awk -f
#
# pdb_blank_segid  script
#
# This script blanks the segid
#
# Usage: see usage statement (type 'pdb_blank_segid' without arguments)
#
# Example:
# input lines:
# ATOM     32  CD1 LEU     2      -6.002  10.544   9.006  1.00  0.00      A   
#  output lines:
# ATOM     32  CD1 LEU A   2      -6.002  10.544   9.006  1.00  0.00      A   
# 
# Remarks: 
#  - Only ATOM and HETATM records are affected.

BEGIN {
    if ( ARGC == 1 ) {
	print "Usage: pdb_blank_segid inputfile > outputfile"
	print "Action:"
	print "the segid given in column 73:76 is blanked"
	exit
    }
}

$1 == "ATOM" || $1 == "HETATM" {
    printf( "%s%s%s\n", substr($0,1,72), "    ", substr($0,77) )
    next
}

{
    print $0
}
