in reply to Doing a find/replace on the nth line

for just the third line

perl -pi -e "$.== 3 and s/searchpattern/replacepattern/" filename

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon