Skip to content

One Liners

I need a oneliner that....

Removes blank lines -- on Mac OS

sed -i.bak '/^[[:space:]]*$/d' gitlab.rb

An alternative for gitlab.rb and friends:

grep -v '^#' gitlab-rb.txt  | gsed  's/#.*$//;/^$/d'

Replaces commas with a newline character

Context: I had a log file that was many MB in size but wc reported 0 lines. Why? How? Unknown. Using grep is very painful so let's fix the log.

tr , '\n' < production.log

That's OK.

sed 's/, "/\
/g' production.log

(Silently) Automates the creation of SSH keys

⚠️ Use with extreme caution. This suggestion will overwrite ~/.ssh/id_rsa so modify to suit!

ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa <<< y

In order to test something once, I used this for loop with seq to automate the creation of a bunch of SSH key pairs:

for i in $(seq 1 24) ; do echo $i;  mkdir -p ohwowwhoa$i;  ssh-keygen  -t rsa -N '' -f ./ohwowwhoa$i/id_rsa$i <<< y ; done

Miscellaneous Stuff

task export | task2dot | dot -Tsvg > test.svg
task export | task2dot | dot -Tsvg > test.svg && open test.svg


rg  -g '!{locale/*}'  'or sign in with'