I have the output logs which are created from Seg-Y files. Example :
TRACE HEADER===============================================================================
There a number of ways to do this. Maybe the simplest is just using
exec <yourexistingscript>
You know your script pulls the right stuff out, just have Tcl run that.
Otherwise, here's a basic skeleton of how I write file-parsing code in Tcl when I'm doing it from scratch:
set fh [open "file.dat", "r"]
while {[gets $fh line] >= 0} {
if {<line matches pattern 1>} {
}
if {<line matches pattern 2>} {
}
}
close $fh
etc, where the <line matches pattern N>
parts are either [string match...]
or [regexp ...]
lines, depending on the situation. This is basically exactly how awk
works. A line-based thing with matches and code to run on them.
The code inside those matches will also vary depending on the situation, but a typical chunk uses [split]
to break the line up by some delimiter. It looks like a space might work here, but I haven't perused your file in detail.