sed
for substitute the second occurrence is:
sed "/dog/ {n; :a; /dog/! {N; ba;}; s/dog/big_dog/; :b; n; $! bb}" your_file
Explanation:
/dog/ { # find the first occurrence that match the pattern (dog)
n # print pattern space and read the next line
:a # 'a' label to jump to
/dog/! { # if pattern space not contains the searched pattern (second occurrence)
N # read next line and add it to pattern space
ba # jump back to 'a' label, to repeat this conditional check
} # after find the second occurrence...
s/dog/big_dog/ # do the substitution
:b # 'b' label to jump to
n # print pattern space and read the next line
$! bb # while not the last line of the file, repeat from 'b' label
}
Note that last 3 commands are needed to print the rest of the file after found the second occurence, otherwise the substitution may be repeated for each even occurrences of the searched pattern.