Commandline

Setting alarm from commandline

2021-11-08

This is just a quick one. Although I use Gnome Clocks occassionally, most of the time I set an alarm via the commandline. OS is POP_OS!, using VLC: $ sleep 10m && \ cvlc ~/alarm.mp3 –play-and-exit && \ notify-send 'alarm done'

Alarm · Cmdline · Commandline · Gnome · Linux

1 minute

Simple string manipulations (splits/replaces) with awk

2020-06-17

For personal reference: Lately, I’ve been doing loads of CSV processing on the terminal with lots of string replacing/splitting. There are probably better (shorter) ways to do this but I’ve been leaning on awk a lot recently. Some examples. One-line separator replace: $ echo "1,2,3,4,5" | awk '{gsub(/,/," ");print}' 1 2 3 4 5 # Then I can use it with something like: for v in $(echo "1,2,3,4,5" | awk '{gsub(/,/," ");print}'); do echo "val=$v"; done val=1 val=2 val=3 val=4 val=5 # Another separator: $ echo "1|2|3|4|5" | awk '{gsub(/|/,",");print}' 1,2,3,4,5 # Join multiple lines with a separator.

Awk · Commandline · Split · String

1 minute