Skip to content
Advertisement

Read first line in a file and append it to first occurrence of the search string and Repeat until EOF

I have a file with following lines in a text file in following format

JavaScript

And a json file in following format

JavaScript

Now i want output of json as follows

JavaScript

So how can achieve this using bash?

I’ve tried with following but it only appends last line of the file.

JavaScript

Advertisement

Answer

This will do it:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement