Hi All,
Please help i have written an ksh script, where i am actually take count of lines in one file and want to update this count to 2nd field of a new file and apend the this into an existing file.
Note the below script is in for loop
-------- I am apending few records in a file ($file) below --
cat /mi/int/workingdir/$file >> Rep101_$j.txt
---taking count of records in the file
cnt_rt3=`wc -l <$file` >
------ i want to put this count in 2nd field's place of rectype_3.txt and apend this in the file Rep101_$j.txt
awk - v cnt=$cnt_rt3 -F"," '{printf("%s,%s",$1,cnt)}' rectype_3.txt >> Rep101_$j.txt
----------- When i am trying to do above, i am getting below error.
+ awk - v cnt= 9 -F, {printf("%s,%s",$1,cnt)} rectype_3.txt
+ 1>> Rep101_10.txt
Syntax Error The source line is 1.
The error context is
>>> - <<<
awk: 0602-500 Quitting The source line is 1.
------------- Please help me, i need to finish the script asap n deliver it to my supervisor.