How to add some string in end of each line inside a file in Linux Bash Shell ?
In this post, we will look at a quick tip, how to add some string in the end of each line in Linux.
To achieve this task, there may be many ways, however the easy and convenient way that i prefer to use is sed command.
Append “***” in the end of each line
### file4 has following contents [root@nglinux ~]# cat file4 hello how are you ### Lets put *** at end of each line [root@nglinux ~]# sed -e 's/$/***/' file4 hello*** how *** are *** you*** [root@nglinux ~]# ### We can use -i option to do in place editing above and change file4. ### Here it replaces $ the end character of each line with ***
Nice tip :).
Now you can add any text like this in the end of each line in the file.