#!/usr/bin/perl
#Script to extract load-displacement curves from spcforc and nodfor files.

$file = $ARGV[0];
open(FILEIN, "<$file") || die "Could not open $file\n";

while($line = <FILEIN>) {   
    if($line =~ m/n o d a l/){
	($junk, $time)=
	    split('t=', $line);
	 chomp $time;      
    }

    if($line =~ m/xtotal=/){
	
	($junk, $junk, $xtotal, $junk, $ytotal, $junk, $ztotal,$junk)=
	    split( /\s+/, $line);
	
	print $time, "\t", $xtotal,"\t", $ytotal, "\t", $ztotal,"\n";	

    }


}


