Fix indexing issue in the pull code
[gromacs.git] / scripts / grompplog2top
blobcc8548d9889401bcfb4d1728a8bf464462d7b3f2
1 #!/bin/csh -f
3 if ( $#argv < 2 ) then
4 set in = grompp.log
5 set out = topolout.top
6 set program = $0
7 echo "usage $program:t $in $out"
8 echo "Parses grompp debug logfile into original processed topology file"
9 else
10 set in = $1
11 set out = $2
12 endif
14 if ( -f $out ) then
15 if ( $out:h == $out:t ) then
16 set backup = \#$out:t\#
17 else
18 set backup = $out:h/\#$out:t\#
19 endif
20 echo "Back Off! I just backed up $out to $backup"
21 \mv $out $backup
22 endif
23 if ( ! -f $in ) then
24 echo "FATAL ERROR: input file $in does not exist"
25 exit 1
26 endif
28 echo -n "Processing..."
29 grep -E '(\".*\" : .* :)|(found directive)' $in | sed 's/found directive '\''\(.*\)'\''/[ \1 ]/' | sed 's/\".*\" : .* ://' >! $out
30 echo "."
32 #last line