I am looking for assignment of value of variable to another variable in awk.
Below is the example
if (substr($0,1,1) == "4")
{
COUNT_DETAIL_SEG++
SUM_OF_DETAIL_RCDS=$(COUNT_DETAIL_SEG)
print "Sum of detail records is" SUM_OF_DETAIL_RCDS
}
Suppose if 1st character of line comes out to be "4" then i want to increment value of COUNT_DETAIL_SEG and assign this value to SUM_OF_DETAIL_RCDS and thereby print it.
But i am unable to retain this value.
Can anyone have any idea about this?