akshay@nio:/tmp$ cat static_word
Insert
update
delete
fieldcomp
lob
After Images
akshay@nio:/nio$ cat file
SCOTT.TEMP_TBL Partition 4
Total Data Bytes 26084
Avg Bytes/Record 326
Insert 8
FieldComp 72
After Images 80
akshay@Aix:/nio$ awk 'FNR==NR{B[A[FNR]=$0]=0;next}{for(i in A)if(match(tolower($0),tolower(A)))B[A]=$NF}END{for(i=1;i<=length(A);i++){ h = h ? h OFS A : A; d = d ? d OFS B[A] : B[A] } print h RS RS d }' OFS='|' static_word file
Hi Rudi, Your code results if value is null then count is 0.
I also need if static word exist in file,place the value.
Based on your code, below came in my mind.
while read line
do
if [ $(grep -ic "$line" testgg.qa.txt1) -ne 0 ]; then
Delete=`cat testgg.qa.txt1| egrep -i "Delete" | sed 's/ */ /g' | cut -d" " -f2`
else
Delete=0
fi
done < static_file
I m trying if I can get it in single line and assign to variable.
Regards,
Veera
Actually, you need some extensions to POSIX requirements to process the above script. The current standard specifies the behavior of $((expression)) , but not the behavior of ((expression)) . ( ksh88 does not support ((expression)) .)