Blog

learnings

Shell script to move duplicate files

macos shell

I setup Firefox on macOS to automatically download files to my “Downloads” folder without prompting (under Preferences... > Downloads, and select Save files to... instead of Always ask you where to save files). If there is an existing file with the same name, Firefox appends (1) to the filename (then (2), (3) and so on). Over time, I land up with files with similar file names, which may or may not be identical. This shell script finds and moves duplicate files to a different folder... for subsequent manual deletion.

Continue reading...

macOS zsh configuration

guide macos shell

From macOS Catalina 10.5 onwards, zsh is the default shell, instead of bash. I have a lot to learn about this shell, and so far, this is how I configured zsh... There is an overload of snippets on-line, but I’ve not seen a post doing what I do, so hopefully this helps someone!

Continue reading...

A bash script to search a CSV file

coding macos shell regex

I sometimes need to search a huge CSV file (13 MB), containing 21,000 rows and roundabout 40 columns, which Numbers takes half a minute to open. All I need to do is search and display the results of a few columns only... so I wrote a bash script to do this for me - and I was quite specific in that I wanted the results in color!

Continue reading...