Thursday, September 5, 2013

Bash one liner

I can't believe it took me this long to figure this out but an easy way to do one liners in bash for multiple files:
~$ for name in *.pdf; do pdftotext "$name"; done

2 comments:

  1. By the way, for static content:
    ~$ for n in folder1 folder2 folder3; do cd $n; rm index.html; cd ..; done

    ReplyDelete
  2. A helpful way I have used this:
    for chk in `pkg-config --cflags webkit-1.0 | sed s/-I//g`; do if [ ! -e $chk ]; then echo "no $chk"; fi; done
    Checks to make sure all include folders exist

    ReplyDelete