LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Dynamically update a file with variable data (https://www.linuxquestions.org/questions/programming-9/dynamically-update-a-file-with-variable-data-4175629864/)

garich01 05-17-2018 02:55 AM

Dynamically update a file with variable data
 
Hi,

Is there a tool in Linux that will allow me to insert row into a file from a variable or array?

I have been looking at Sed but i dont need to search and replace specific data within a file. In this example I would like to create a file named test, insert a row into test from an array or variable, perform a curl action with file test, loop around, replace the top row in file test with new data from an variable or array, perform an curl action with file test, loop around and continue until the loop is complete.

Is there a file editor that will allow me to perform this action?

Cheers

syg00 05-17-2018 03:08 AM

sed.

Substitute (s) is just one of the things it allows you to do - look at insert and/or append.

NevemTeve 05-17-2018 08:08 AM

"Insert" means "append" or something else?

syg00 05-17-2018 05:55 PM

See the documentation.


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