execute a system command with awk

create a new column with value of command output

awk '{ "date +%F" |& getline $4; print }' <<<'a b c'

creating a file

awk '"touch test_file" |& getline' <<<''

alternating monitor resolution

awk '/*/ { if ( $1 == "1368x768" ) { "xrandr --output eDP1 --mode 1920x1080" |& getline } else { "xrandr --output eDP1 --mode 1368x768" |& getline } }' <(xrandr)

Leave a comment