line by line read

hi,

how to read a file line by line and patch the read line ($3) into the new file $x?

Use awk or a while loop. When you get to the desired place in the file, use echo or print or printf to send the line you want to the output.

Redirect the ouput to a new file. For example, to insert something after line no. 3:

awk -v newline="This is a new line" '{ print } ## print every line
NR == 3 { print newline }' FILENAME > NEWFILE


Thank you very much..... it's working now...