Alpine3D

Alpine3D Svn Source Tree

Root/trunk/tests/simple/find_first_change.sh

  • Property svn:executable set to *
1#!/bin/bash
2#Find the first line that has changes in a MET file and show which fields have some changes
3
4#diff -w output_ref/5_2_dischma.met output/5_2_dischma.met | head -100 | grep -E "^[0-9]+c[0-9]+$" | head -1
5
6TEST="5_2_dischma.met"
7INPUT_REF="output_ref/${TEST}"
8INPUT_TEST="output/${TEST}"
9PREC="1e-3"
10numdiff -s', \t\n' -r ${PREC} --speed-large-files ${INPUT_REF} ${INPUT_TEST} | head -50 | awk '
11BEGIN { #read fields names
12FS=","
13cmd="head -15 '${INPUT_REF}' | grep ID"
14while ((cmd | getline) > 0) {
15for(ii=1;ii<=NF;ii++) header[ii]=$(ii)
16}
17close(cmd)
18FS=" "
19}
20/^---/ {
21if(section==0)
22section=1
23else {
24printf("In test %s, at line %s:\n", "'"${TEST}"'", line)
25for(field in orig) {
26printf("\t%-40s is %10g, was %10g\n", header[field], new[field], orig[field])
27}
28section=0
29}
30next
31}
32(section==1) {
33if ($0~"#") {
34gsub(/#|:/, "")
35line=$1
36field=$2-1#because the timestamp is seen as 2 fields
37if ($3=="<==") orig[field]=$4
38else new[field]=$4
39}
40}
41END {
42printf("In test %s, at line %s:\n", "'"${TEST}"'", line)
43for(field in orig) {
44printf("\t%-40s is %10g, was %10g\n", header[field], new[field], orig[field])
45}
46}
47'

Archive Download this file

Revision: HEAD