Saturday, February 18, 2012

Creating EBCDIC Header Files From The SEG-Y

Hi Folks

Copy and paste this.  Free up permissions and all.  It scans through a directory and extracts the EBCDIC header from the SEG-Y.  Mighty fun?  Not!  Caution, this runs through every file.  So careful what's in there.


#!/bin/bash


files=*
for f in $files
do


# this needs to be one long string
  for i in 1 80 160 240 320 400 480 560 640 720 800 880 960 1040 1120 1200 1280 1360 1440 1520 1600 1680 1760 1840 1920 2000 2080 2160 2240 2320 2400 2480 2560 2640 2720 2800 2880 2960 3040 3120
    do
      # this needs to be one long string too
      out=$(dd if=$f bs=1 skip=$i count=80 conv=ascii status=noxfer
)
      extention=_header.txt
      combo=$f$extention
      echo $out >> $combo
    done
  echo "finished processing file "$f
done