Bash
From Cheatsheet
Bash is cool, you can do stuff with it
Notes
- Tutorial start here: http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
- Good basic tutorial: http://tiswww.case.edu/php/chet/bash/bashref.html
- Good FAQ here: http://wooledge.org/mywiki/BashFAQ
| #!/bin/bash | the first line always |
| A=`grep whatever somefile` echo $A | runs a command, assigns it to the variable "A", then prints that variable. Note: you need the backward single quote around the command |
| tee output_file.txt | word counts my_text_file.txt and then outputs the results to output_file.txt |
| sed -n '/^\s*#/{N;s/^#.*\n//p}' somefile | super cool stream editor |
| -n | suppress automatic printing of pattern space |
remove spaces in filenames
for file in *; do mv "$file" `echo $file | sed -e 's/ */_/g' -e 's/_-_/-/g'`; done
