I have file with the below info
testing testing testing
I want to insert a word(tested) before the first testing word using sed or any linu
This might work for you (GNU sed):
sed -e '/testing/{itested' -e ':a;n;ba}' file
Insert tested before the first match of testing and then use a loop to read/print the remainder of the file.
tested
testing
Or use the GNU specific:
sed '0,/testing/itested' file