-
zsh grep and mvim: search for a string in a directory in file type, and open that point
open_all {pattern} {extension} #!/bin/zsh grep -n $1 **/*$2 | sed ‘s/^([a-zA-Z_/.]*):([0-9]*).*$/2 1/’ | while read line file do mvim –remote-tab-silent +$line $file done Usage: # find all occurrences of “def” as a whole word and open the files in separate tabs: open_all ” .rb
-
Creating a Readable List of Playlist songs on Mac
1. Select Export… by two-finger/right-clicking on the playlist. 2. Export as plain text. 3. I had to do a little command-line scripting to change carriage returns to new lines and select only the first two tab-limited columns: cd ~/Desktop cat Power of Two.txt | tr ‘r’ ‘n’ | awk -F ‘t’ ‘{print $1 “::” $2}’…
-
Shell / awk script to generate getter / setter stubs for .java file
I realize many IDEs do this, but I felt like writing a few lines of script to spit this out instead. This will grab every line marked “private”, whether method or member variable and generates a default getter/setter. Note: it doesn’t insert the code for you or even capture to a file. Maybe next I’ll…