find the position in a file and insert the data there

Hi,

I have a EDI data file ARROWTEST of size 18246 characters. And I want to insert some data after 4200 position in the file. How I can find the position 4200 in that file....Please advise.

Regards,

Try using split -b, e.g...

split -b 4200 infile  tmpfile.
for file in tmpfile.??
do
    cat $file
    if [[ $file = tmpfile.aa ]]
    then
       printf "additional data goes here"
    fi
done > outfile
rm tmpfile.??

this would reduce the overhead of file comparison,
once data is pumped after 4200 bytes,

>w.ksh

split -b 4200 infile  tmpfile.
cat tmpfile.aa
echo "pump data"
cat tmpfile.a[!a] 
>./w.ksh > outputfile

but would file for split commands generating more than 26 files...

I fail to see the point of changing my script to one that is uglier, more limited and leaves temp files behind.

yes,

i should have included
/bin/rm tmpfile.??

If that is so... how would your current script handle situations if it had to generate more than 676 files? (Anyway solution to that bottleneck is also available)

Your script is limited to 26 files and mine is limited to 676 files. So your script is more limited.