Article 59QE0 bash - Replace text on a specific line

bash - Replace text on a specific line

by
fuqalufo
from LinuxQuestions.org on (#59QE0)
Hello ;)

Code:sed '4 s/A/B/' testfile.txtThis command on the 4th line finds A and replaces it with B.

How to write it in a bash script when a string is specified as a variable? it is necessary that only in the specified line of the text file change A to B. For some reason, I get it on all lines.

Thanks.latest?d=yIl2AUoC8zA latest?i=whFd5dpoENQ:fC0Y6L2Jb7s:F7zBnMy latest?i=whFd5dpoENQ:fC0Y6L2Jb7s:V_sGLiP latest?d=qj6IDK7rITs latest?i=whFd5dpoENQ:fC0Y6L2Jb7s:gIN9vFwwhFd5dpoENQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments