nawk Wert einer Variablen zur 2. Spalte eines Files addieren

wie kann ich zu dem 2. wert eines files den wert einer variable hinzuf�gen bei nawk?

ich habe folgendes:

nawk '{system("echo "$1" "$2+22)}' filename

das funktioniert -> so wird beim zweiten wert 22 hinzugez�hlt!

ich m�chte aber nicht 22 hinzuf�gen sondern den wert, der in der variablen itest steht! wie mache ich das?

so funktionierts nicht:

declare -i itest=22

nawk '{system("echo "$1" "$2+${itest})}' filename

wie geht es, dass ich zu jedem 2. wert des files den inhalt meiner variablen hinzuf�ge?

I have following problem: when I use this command - it works fine:

nawk '{system("echo "$1" "$2+22)}' filename

but when I want to add to the second column of the file (filename) the content of the variable itest I get an error! how can I add the content of the variable itest to every value of the second column of the file?

the following doesnt work:

declare -i itest=22

nawk '{system("echo "$1" "$2+${itest})}' filename

can someone help me?

nawk -v itest="22" '{print $1 " " $2+itest)}' filename

Regards

it works after 4 hours without solution! Thank you for your help!

I want to make a bash script and declare my variables at the beginning of my programm with all my commands!

#!/usr/bin/bash

declare -i inoargs=0
declare -i iusedpseudo=0
declare -r filestart="map"
declare -r fileend=".out"
declare -r command1="`/usr/bin/tail -1 $1${fileend} | awk '{print $2}'`"

while [ $# -gt ${inoargs} ]
do
iusedpseudo=0
# now file $1${fileend} will be created with: do something > $1${fileend}
iusedpseudo=${command1}
echo ${iusedpseudo}
shift
done

I get an error because when i declare command1 the file $1${fileend} does not exists! how can i solve this problem, that i can declare the command at the beginning of the script?

Wenn du eine verschiedene Frage hast, geht es besser eine neue "Thread" zu anfangen...

Ver�ndern bis so:

declare -r command1="/usr/bin/tail -1 $1${fileend} | awk '{print $2}'"
# keine "backtick"
...
...
iusedpseudo=`${command1}`
# steck die backticken hier ein.