Reply to comment

  • Anonymous (not verified)
    Sat, 2008-10-04 16:08

    It's a bit OT but you can write that shell script a bit better:

    python manage.py inspectdb |
    grep "^class" |
    sed "s/^class //g" |
    cut -d"(" -f1 |
    xargs -I {} echo 'databrowse.site.register({})'\
    >> urls.py

    E.g., why use both a \ and a | when the | alone suffices?
    And of course you can go better: the following will
    combine the sed and grep steps:

    sed -n "/^class /s///gp" |

    With more work you could combine the grep, sed and cut with a single sed or (preferably) awk.

  • Reply

    The content of this field is kept private and will not be shown publicly.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.

    More information about formatting options


    CAPTCHA
    This question is for testing whether you are a human visitor and to prevent automated spam submissions.