Skip to content

Instantly share code, notes, and snippets.

@strokirk
Created February 17, 2016 13:52
Show Gist options
  • Select an option

  • Save strokirk/051b848be4f2e50eb131 to your computer and use it in GitHub Desktop.

Select an option

Save strokirk/051b848be4f2e50eb131 to your computer and use it in GitHub Desktop.
Shell script to generate imports in python
cat .git/tags | grep "\(f\|c\)$" | awk '{print $1, $2}' | tr / . | sed -e s/\.py$// -e s'/\.\.\.//' | awk '{print "from", $2, "import", $1}' | sort
@strokirk
Copy link
Copy Markdown
Author

Det här är kortare

< .git/tags grep "[fc]$" | cut -f1,2 | tr / . | sed '/\.py$/!d; s/\.py$//p; s/\.\.\.//' | awk '{print "from", $2, "import", $1}' | sort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment