4 #The metadata creation scheme makes a json file as part of the job running.  We can't pass the name of the json to the extractor so we will need to assume a json name 
    5 #The assumed json name is hist_STAGE.root.json 
    6 #The input file has been uniquely renamed by the time this script is called so we need to use some regex magic (thanks Marc!) to reconstruct the original json name 
    9 JSONFILE=`echo $INPUTFILE | sed -re 
's/-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}//'`
 
   10 JSONFILE=
"${JSONFILE}.json" 
   13 #We need to remove the braces at the end of the file as we are going to append more information 
   14 sed -i 
'$ d' $JSONFILE
 
   15 #We also need to add a comma to the end of the last line now that we are going to add more line 
   16 sed -i 
'$ s/$/\,/g' $JSONFILE
 
   18 #Add the filename back in 
   19 sed -i 
"\$a \"file_name\": \"$(basename $INPUTFILE)\"," $JSONFILE
 
   21 FILESIZE=`wc -c < $INPUTFILE`
 
   22 sed -i 
"\$a \"file_size\": \"$FILESIZE\"," $JSONFILE
 
   27 sed -i 
"\$a \"checksum\": $CHECKSUM," $JSONFILE
 
   30 #Make sure that the last entry does not have a comma at the end of its line 
   31 sed -i 
'$ s/,//g' $JSONFILE
 
   33 ##re-add the closing brace 
   34 sed -i 
'$a }' $JSONFILE
 
   36 #Dump the json to std::out, needed for metadata_extractor 
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project production production checksum
stream1 can override from command line with o or output services user sbnd