LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to overwrite a particular line of a file (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-overwrite-a-particular-line-of-a-file-642558/)

kkpal 05-16-2008 01:45 AM

how to overwrite a particular line of a file
 
hi all

what is command for overwriting a particular line (number 113) of a text file using Bash script.

Regards
Komal K Pal

colucix 05-16-2008 02:35 AM

You can try sed specifying the line number and substituting any sequence of characters with the new text:
Code:

sed 113s/.*/new text here/ file
if you want to edit file in place, use the -i option, but before doing this, test the results or make a backup copy of the original file.


All times are GMT -5. The time now is 08:05 AM.