To parse out a variable length field between two fixed length fields. awk '{ print substr($0,1,32) substr($0,length($0)-107) }' d130.txt substr($0,1,32) parses out the leftmost chunk of the record. 32 is the size of that chunk. substr($0,length($0)-107) parses out the rightmost chunk of the record. 107 is the size of that chunk. length($0) determines the record length. length($0)-107 determines the starting point for the substr.