{"id":583,"date":"2012-06-26T13:37:02","date_gmt":"2012-06-26T13:37:02","guid":{"rendered":"http:\/\/www.budus.it\/Blog\/?p=583"},"modified":"2017-06-18T07:32:54","modified_gmt":"2017-06-18T07:32:54","slug":"proengineer-individuare-dove-e-montato-un-componente-in-base-al-codice-dentro-gli-assembly","status":"publish","type":"post","link":"https:\/\/www.budus.it\/Blog\/proengineer-individuare-dove-e-montato-un-componente-in-base-al-codice-dentro-gli-assembly\/","title":{"rendered":"Pro\/Engineer: Individuare dove \u00e8 montato un componente in base al codice dentro gli assembly"},"content":{"rendered":"<p>Ho realizzato uno Bash Script il cui scopo \u00e8 quello, fornendo il codice di un componente, individuare in quali assiemi \u00e8 montato e mostrare le dipendenze degli stessi.<\/p>\n<p><!--more--><\/p>\n<p>E&#8217; utile per coloro che, come me, devono operare senza Pro\/Intralink; lo script, su Windows, pu\u00f2 essere eseguito tramite <a title=\"Installazione dell\u2019ambiente di sviluppo MinGW + MSYS + EMACS + FLTK\" href=\"https:\/\/www.budus.it\/Blog\/?p=91\">MSYS<\/a>.<\/p>\n<p>Questo \u00e8 il sorgente dello script:<\/p>\n<pre>#!\/bin\/bash\r\n\r\n# Questo script serve per individuare, all'interno degli assembly, il\r\n# codice specificato.\r\n\r\n################################################################################\r\n#_______________________________________________________________________________\r\nmax_level=32\r\n\r\n################################################################################\r\n#_______________________________________________________________________________\r\n[ \"${1}\" == \"\" ] &amp;&amp; printf '\\nERRORE: Devi specificare il pattern di ricerca.\\n' &amp;&amp; exit 1;\r\n\r\n################################################################################\r\n#_______________________________________________________________________________\r\npattern_matching_path_db=$(echo \"\/tmp\/PROE_find_${1}.dat\" | sed 's@[^a-zA-Z0-9._\/-]@_@g')\r\n\r\n################################################################################\r\n#_______________________________________________________________________________\r\nmatches=$(grep -iF \"${1}\" *.asm.* | sed 's@Binary file @@' | sed 's@ matches@:@' | awk -F':' '{print $1}' | sed 's@\\.[0-9]*$@@' | sort | uniq)\r\nlevel=$((${2:-0} + 2))\r\n\r\n################################################################################\r\n#_______________________________________________________________________________\r\nif [ ${level:-0} -le 2 ]; then\r\n    rm -f \"${pattern_matching_path_db}\"\r\nfi\r\n\r\n################################################################################\r\n#_______________________________________________________________________________\r\nfor match in ${matches}; do\r\n    sub_match=$(echo \"${match}\" | sed 's@\\.\\(asm\\|prt\\|drw\\)\\(\\.[0-9]*\\)\\?$@@')\r\n    find_match=$(echo \"${1}\" | grep -iF \"${sub_match}\")\r\n\r\n    [ \"${find_match}\" == \"\" ] &amp;&amp; printf \"%${level}s |_ %s\\n\" \" \" \"${match}\"\r\n    if [ ${level:-0} -le ${max_level:-16} ]; then\r\n\tis_loop=$([ -f \"${pattern_matching_path_db}\" ] &amp;&amp; grep -Fi \" ${match} \" \"${pattern_matching_path_db}\")\r\n\techo \" ${match} \" &gt;&gt; \"${pattern_matching_path_db}\"\r\n\r\n\t[ \"${is_loop}\" == \"\" ] &amp;&amp; [ \"${find_match}\" == \"\" ] &amp;&amp; $0 \"${sub_match}\" ${level}\r\n    else\r\n\tprintf \"%${level}s |_ %s\\n\" \" \" \"[${match}]\"\r\n    fi\r\ndone\r\n\r\n################################################################################\r\n#______________________________________________________________________________\r\nif [ ${level:-0} -le 2 ]; then\r\n    rm -f \"${pattern_matching_path_db}\"\r\nfi\r\n\r\n################################################################################\r\n#_______________________________________________________________________________<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ho realizzato uno Bash Script il cui scopo \u00e8 quello, fornendo il codice di un componente, individuare in quali assiemi \u00e8 montato e mostrare le dipendenze degli stessi.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[176,7,114,99],"class_list":["post-583","post","type-post","status-publish","format-standard","hentry","category-cad","category-software","tag-bash","tag-proengineer","tag-ptc","tag-script"],"_links":{"self":[{"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/posts\/583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/comments?post=583"}],"version-history":[{"count":2,"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/posts\/583\/revisions"}],"predecessor-version":[{"id":864,"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/posts\/583\/revisions\/864"}],"wp:attachment":[{"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/media?parent=583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/categories?post=583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.budus.it\/Blog\/wp-json\/wp\/v2\/tags?post=583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}