> Excessive sloping matchstick substitutions in sed make my eyes water - I > find it conceptually easier to break at whitespace into separate lines: I just use bash itself. It's a little more typing, but more adaptable and readable. set -- $(cat /proc/cmdline) for arg in "$@"; do case $arg in ip=*) ip=${arg#ip=} ;; esac done Of course, you could use --interpreter /usr/bin/python, in which case, you'd have: for arg in open('/proc/cmdline').read().split(): if arg[0:3] == "ip=": ip = arg[3:]