Adding a columnfrom a specifit line number to a specific line number

Hi,

I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers.

To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello" to 5th column but from line 1 to line 200. & I want to add another text "goodbye" to 5th column of the same file from line 201 to 800 & another text "live" again to 5th column to the same file from line 801 to 1000.

I know I can use sed to add a column to my file but I don't know how to tell sed to add this column to from line & to to line.

$ sed 's/\(.*\) \(.*\) \(.*\) \/\1 \2 \3 \  Desired string/' input > output

this will add my desired string to the 4th column in the right place but I don't know how to limit this to a specific range of lines.

May be there is a way to do it in sed or may be awk?

Any help will be very welcome.

Thanks in advance,
Ezy

awk ' NR >=1 && NR <= 200 { print $0 " Hello" }
        NR >=201 && NR <=800 { print $0 " Goodbye"}
        NR >=801 && NR <=1000 { print $0 " live"}' <filename>

Oh thanks a lot....this works perfectly fine & it seems fast enough to work with huge files.

Thanks a lot :b: