i have this function search which return $var correspondant to $file and $2 string to find :
search ()
{
cat $1 | awk -v s="$2" 'BEGIN{
n=""
}
{
if ($0 ~ /FEATURE TESTED /)
{
n=$0
}
if (index($0,s)!=0)
{
if (n!="")
print n
n==""
}
}' | sed 's/$ ###### FEATURE TESTED : "//' | sed 's/"//' | sed 's/ /_/g'> $3
var=`awk '{print $1}' $3`
}
i will call this function in this code to print $var in correpondant $3 if it's null
awk -F "," '{ {first=$1; sec=$2; tro=$3;quat=$4 }
if (tro == "")
{
search "$file4" "$1" "$file5"
{print $1","$2","$var","$4} }
else
{print $1","$2","$3 $4}}' $file1 > $file2
file 1 contain four variable delimitated by comma
if $3 is null i call the function search to pirnt the $var correpondant to $1 ( first)
the function search works well but i can't print the $var in $3 in this code.
thanks
but it doesn't work i can