A simple example, using env as input:
$ env | grep EDITOR
EDITOR=vim
$ env | awk -F= '{a[$1]=$2} END {print(a["EDITOR"])}'
vim
It's way easier to just do echo $EDITOR
though.
But sometimes it's not so easy:
$ xdotool getactivewindow getwindowgeometry --shell | awk -F= '{a[$1]=$2} END {print(a["WIDTH"])}'
1430
If you want to get the current window's width.
_
= M =
Top comments (0)