|
Last change
on this file since 4249 was
4195,
checked in by dubos, 6 years ago
|
|
simple_physics : scripts to facilitate transition to logging feature
|
-
Property svn:executable set to
*
|
|
File size:
695 bytes
|
| Line | |
|---|
| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | echo <<EOF |
|---|
| 4 | usage : replace_print file1 file2 ... |
|---|
| 5 | This script replaces occurences of PRINT and WRITE with the macro WRITELOG |
|---|
| 6 | User is asked for confirmation before overwriting original file. |
|---|
| 7 | This script is basic and you should check results as corner cases are not handled. |
|---|
| 8 | EOF |
|---|
| 9 | |
|---|
| 10 | function replace() |
|---|
| 11 | { |
|---|
| 12 | FILE=$1.new |
|---|
| 13 | cp -f $1 $FILE |
|---|
| 14 | # WRITE => WRITELOG |
|---|
| 15 | sed -i -e "s/\bwrite(\b/WRITELOG(/g" $FILE |
|---|
| 16 | sed -i -e "s/\bWRITE(\b/WRITELOG(/g" $FILE |
|---|
| 17 | # print * => WRITELOG(*,*) |
|---|
| 18 | sed -i -e "s/\bprint\*\,/WRITELOG(*,*) /g" $FILE |
|---|
| 19 | sed -i -e "s/\bPRINT\*\,/WRITELOG(*,*) /g" $FILE |
|---|
| 20 | diff $1 $FILE |
|---|
| 21 | cp -i -u $FILE $1 |
|---|
| 22 | rm -f $FILE |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | for FILE in $* ; do |
|---|
| 26 | replace $FILE |
|---|
| 27 | done |
|---|
Note: See
TracBrowser
for help on using the repository browser.