Skip to content

Instantly share code, notes, and snippets.

@tmadlener
Last active May 18, 2017 13:59
Show Gist options
  • Save tmadlener/1371cd7958cb063d79dd716a561796ce to your computer and use it in GitHub Desktop.
Save tmadlener/1371cd7958cb063d79dd716a561796ce to your computer and use it in GitHub Desktop.
#!/bin/bash
menuFile=${1}
## part extracting the modules and the corresponding seeds
menuFile=${1}
outputFile="modules_seeds.txt"
# extract the L1 seed modules
moduleNamesFile="modules.txt"
grep HLTL1TSeed ${menuFile} | sed 's/cms.EDFilter( \"HLTL1TSeed\",//' > ${moduleNamesFile}
# extract the seed expression used in the modules
seedFileName="seeds.txt"
grep -A8 HLTL1TSeed ${menuFile} | grep L1SeedsLogicalExpression | sed 's/L1SeedsLogicalExpression//' | sed 's/cms.string(//' | sed 's/)//' > ${seedFileName}
# put information together into one more easily readable file
paste ${moduleNamesFile} ${seedFileName} > ${outputFile}
# clean up
rm ${seedFileName} ${moduleNamesFile}
## second part: getting the paths to the seed expressions
# read previously created file
while read -r line; do
module=$(echo ${line} | awk '{print $1}')
seedExpr=$(echo ${line} | awk -F'=' '{print $3}')
path=$(grep ${module} ${menuFile} | awk '{print $1}' | awk -F'.' '{print $2}')
# print seed expression followed by modules using it followed by paths using the modules
echo ${seedExpr} ${path}
done < ${outputFile}
# cleanup
rm ${outputFile}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment