manipulating csv to add extra row

hi

how do i manipulate .csv file to add an extra row after each row using shell script?

I need a blank line added for each 1000 records in my file?

I will then need to copy and paste some data in the blank row created.

thanks 4 ur support
neil

To add a blank line:

awk 'NR%1000==0?$0=$0"\n":1' infile

To add some text:

awk 'NR%1000==0?$0=$0"\nText to be inserted":1' infile

Use nawk on Solaris.

#!/bin/ksh

cntLoop=1
INP_CSV_FILE=$1
OUT_CSV_FILE="$HOME/outfile.csv"
rm -f $OUT_CSV_FILE
for line in `cat $INP_CSV_FILE`
do
        echo $line >> $OUT_CSV_FILE
        echo "Test,Your row here" >> $OUT_CSV_FILE # Addition of a row after each row in CSV
        if [[ $cntLoop -eq 500 ]]       # Addition of a blank line after 1000 records of the output
        then
                echo >> $OUT_CSV_FILE
                cntLoop=0
        fi
        cntLoop=$((cntLoop+1))
done

Code:

ksh compute_csv.ksh infile

thanks all