Skip to content

Instantly share code, notes, and snippets.

@jodell
Created December 28, 2009 05:38
Show Gist options
  • Save jodell/264546 to your computer and use it in GitHub Desktop.
Save jodell/264546 to your computer and use it in GitHub Desktop.
# Bash BAH
# Simple enumeration
for i in $(seq 1 30); do convert ${i}.jpg -resize 90x90 ${i}_90x90.jpg; done
# find/sed/xargs example
# sed here trims all preceding /path/to/foo values (effectively same as basename)
find . -name "mef.*" | sed 's!.*/!!' | xargs -o -I file p4 integ file ~/p4/db/seed/CA/file
# better find/xargs example eliminating need for sed
find AU -name "mef.*" -exec basename {} \; | xargs -I file p4 integ AU/file ~/p4/db/seed/CA/file
# Nothing new here:
ls -1 /home | xargs -I user sudo chown -R user:user /home/user
# sed
sed -i 's/\(^account required\s*pam_python.*\)/#\1/g' /etc/pam.d/common-account
# holla
ls -1 cnu_gems/gems-1.2.0_ruby-1.8.6.287_linux-gnu_i686-linux_Ubuntu-6.06.2-LTS/gems | sed 's/\(.*\)-\(.*\)/\1 -v \2/' | xargs -I gemz sudo cnuapp/bin/cnu_env gem install gemz
# I need a good tee example!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment