[MITgcm-devel] testreport on my mac

Martin Losch Martin.Losch at awi.de
Wed Apr 3 12:05:08 EDT 2019


Hi Jean-Michel and all sed gurus out there,

maybe not so important, but on my MacOS, I cannot run testreport on lab_sea.ad because my “sed” doesn’t give me the correct output when excuting l831:
bkli04m001::run> sed -n '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'
bkli04m001::run> 

gives nothing, but 
>> sed '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'
#----------usedbytestreportforDividedAdjointRun:----------
#numberofadditionalexecutionstoperformisgivenby"add_DIVA_runs"
#andcorrespondsto"nchklev_3"valueinfile"code_ad/tamc.h"
add_DIVA_runs=4

I am using /usr/bin/sed, which is a BSD sed, so I am assuming that it doesn’t know about fancy gnu extensions

On my linux box with a gnu sed, version 4.2.2, I am getting: 

bkli04l006::run> sed -n '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'
add_DIVA_runs=4

and
bkli04l006::run> sed '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'
#----------usedbytestreportforDividedAdjointRun:----------
#numberofadditionalexecutionstoperformisgivenby"add_DIVA_runs"
#andcorrespondsto"nchklev_3"valueinfile"code_ad/tamc.h"
add_DIVA_runs=4
add_DIVA_runs=4

Obviously, the problem is that my BSD sed does not understand the search pattern. I don’t understand it either, that’s why I cannot suggest anything better that does the same thing, but does not rely on GNU extensions. I tried this:
sed -n '/^add_DIVA_runs/p' run_ADM_DIVA | sed 's/ //g’

on both MacOS (BSD) and linux and that seems to work (ie. gives the correct answer), but I have no idea, what side effects this may have. 
Any suggestions?

Martin


More information about the MITgcm-devel mailing list