LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-17-2018, 02:55 AM   #1
garich01
LQ Newbie
 
Registered: May 2018
Posts: 1

Rep: Reputation: Disabled
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
 
Old 05-17-2018, 03:08 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,963

Rep: Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564
sed.

Substitute (s) is just one of the things it allows you to do - look at insert and/or append.
 
Old 05-17-2018, 08:08 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,557

Rep: Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092Reputation: 1092
"Insert" means "append" or something else?
 
Old 05-17-2018, 05:55 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,963

Rep: Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564Reputation: 2564
See the documentation.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] unable to concatenate the variable dynamically shravee Linux - General 6 02-13-2018 03:44 PM
Environment variable that dynamically changes when another variable is changed youtoo Linux - Newbie 4 02-17-2016 01:44 AM
Getting value of an environment variable dynamically naren_0101bits Programming 3 10-30-2007 05:58 AM
Capturing some data from a file into a variable shiroh_1982 Linux - Newbie 3 06-16-2006 05:59 PM
How to read variable from one file & update its value in another file minil Programming 1 03-22-2005 12:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration