1. Read first field in a variable p (semikolon separated fields) and appends it to the text filecopy.txt:
echo $p | awk -F';' '{ print $1 }' >>copy.txt
2. Read the first field in a variable p (semikolon separated) and writes it into the variable taskname:
taskname=$(echo $p | awk -F';' '{ print $1 }')
3. Use variable in awk command
i=2
xrandr | grep "*" | awk -v var="$i" 'NR==var{print $1}'
4. Read the first 3 characters in the systemvariable DISPLAY
echo $DISPLAY | awk '{ print substr($1,1,1)}'