Category: Mac

0

Bash scripting tricks

Bash tricks Check bash version in script if ((BASH_VERSINFO[0] < 4)) then echo “Sorry, you need at least bash-4.0 to run this script.” exit 1 fi   Reading columns from a file in bash array table_collection=( $(cut -d $’\t’ -f1...

0

Old bash version on MacOS ?

What? An older bash version? Are you seeing and still not believing on something like below, MacBook-Pro:~$ bash –version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16) Copyright (C) 2007 Free Software Foundation, Inc. Well that is my MBP as of Mar 29,...

0

Replace invalid code signature in Mac apps

What? Replacing the invalid code signature in mac apps with a new one How? Example: sudo codesign –force –sign – /Applications/DBeaver.app Symptoms MacOS gives messages like – “Dbeaver” is damaged and can’t be opened. You should move it to the Trash.  ...

0

Changing Wine key mappings on Mac OS X

Source: https://palant.de/2014/02/14/crazy-hacks-changing-wine-key-mappings-on-mac-os-x Remap CMD keys on wine (MacOS) One of the biggest quirks of using a Mac is its keyboard — in addition to the usual Control (⌃) and Alt a.k.a. Option (⌥) keys you also have the Command (⌘) key. Unlike...

0

tee command

Split program output to console and to a file Basic usage $ command | tee out_file.txt Appending to the output file using -a $ command | tee -a out_file.txt Redirecting stderr and stdout $ command |& tee -a out_file.txt   Example...

0

Mac OS tips

Change hostname   Change hostname $ sudo scutil –-set HostName <new hostname>   Related posts: Super charge bash with these bash_profile tips SSH Auto completion on OSX Can’t connect Excel to Hive using ODBC driver on MAC brew packages and...

0

AWK Syntax

AWK syntax: awk [-Fs] “program” [file1 file2…] # commands come from DOS cmdline awk ‘program{print “foo”}’ file1 # single quotes around double quotes # NB: Don’t use single quotes alone if the embedded info will contain the # vertical bar...

0

Chart of similar operations with sed and awk

Chart of similar operations with sed and awk ——————————————– string ====== sed “s/from/to/” awk ‘{sub(“from”,”to”); print}’ sed “s/from/to/g” awk ‘{gsub(“from”,”to”); print}’ sed “s/from/to/3” awk ‘{$0=gensub(“from”,”to”,3); print}’ regex ===== sed “s/reg.*$/_&_/” awk ‘{sub(/reg.*$/, “_&_”); print}’ sed “s/reg[ex]/YY/g” awk ‘{gsub(/reg[ex]/, “YY”); print}’...

0

awk one liners

HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 Compiled by Eric Pement – eric [at] pement.org version 0.27 Latest version of this file (in English) is usually at: http://www.pement.org/awk/awk1line.txt This file will also be available in other languages: Chinese -...