addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgoogleimageimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

BASH Scripting and REGEX Basic

Peter Larsen from Red Hat will cover the basics of BASH scripting and how to take advantage of one of the most powerful features in Linux - regular expressions (aka REGEX).  If you want to learn how to automate or batch process tasks, plan on attending this meeting.

Join or login to comment.

  • Paul D.

    Someone at the meeting asked what to do if the shell’s expansion of wildcard parameters overflows.
    Here are two examples of a recursive grep (i.e., fixed grep).
    The first version runs faster but can overflow, the second stores the filenames in a variable before executing fgrep.

    cat ~/bin/rfgrep
    #!/bin/sh
    # rfgrep : Recursive fgrep
    if [ $# -eq 0 ]; then
    echo "Usage: $0 pattern [ filename ]"
    exit 1
    elif [ $# -eq 1 ]; then
    find . -name \* -exec fgrep -n "$1" /dev/null {} \;
    else
    find . -name "$2" -exec fgrep -n "$1" /dev/null {} \;
    fi

    cat ~/bin/rfgrep2
    #!/bin/sh
    # rfgrep2 : Recursive fgrep
    if [ $# -eq 0 ]; then
    echo "Usage: $0 pattern [ filename ]"
    exit 1
    elif [ $# -eq 1 ]; then
    files="find . -name \* -print"
    else
    files="find . -name $2 -print"
    fi
    fgrep -n "$1" `eval $files` /dev/null

    September 29, 2014

  • Peter L.

    Thanks everyone for showing up. As promised, here are the slides for the presentation: http://slidesha.re/1yv9fMk
    Since slideshare doesn't do animations well, I recommend downloading the presentation and view it in LibreOffice Impress presentation mode.

    September 27, 2014

  • Brian

    Is this the first class? Have I missed to much to jump in now?

    September 23, 2014

    • Ted B.

      Welcome to FredLUG. This is the first class on this topic so you haven't missed a thing.

      September 24, 2014

    • Peter L.

      Welcome to FredLug Brian. You can definitely follow along with Fedora or any other Linux distribution since most of them use BASH already. This is not specific to any distribution. Also, come prepared to ask questions and share your experiences.

      September 26, 2014

  • Dave B.

    Hey Peter! Thanks for putting this together! What so you think about briefly covering the bash vulnerability ? Thanks, Dave

    September 26, 2014

    • Peter L.

      It will be covered once we've covered the basics.

      September 26, 2014

10 went

Our Sponsors

  • Red Hat

    Providing Speakers and swaq

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy