Created
July 19, 2021 13:57
-
-
Save peeyushsrj/932f9710d2e695d11f8c4989f8e8f3d9 to your computer and use it in GitHub Desktop.
Revisions
-
peeyushsrj created this gist
Jul 19, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # bash pyunused.sh filename.py s=$(cat $1 | grep import | grep as | awk '{print $4}') t=$(cat $1 | grep import | grep -v as | awk '{print $2}') echo "Following unused packages" echo "-------------------------" for el in $s; do count=$(cat $1 | grep $el | wc -l) if (( ${count} == 1 )); then echo $el fi done for el in $t; do count=$(cat $1 | grep $el | wc -l) if (( ${count} == 1 )); then echo $el fi done