how can i create a file and add to it periodically, retaining the contents of the fileThe profile of...

Is it possible to do 50 km distance without any previous training?

Why does Kotter return in Welcome Back Kotter?

Filter any system log file by date or date range

How do I gain back my faith in my PhD degree?

Can a Cauchy sequence converge for one metric while not converging for another?

Could an aircraft fly or hover using only jets of compressed air?

Do I have a twin with permutated remainders?

Malcev's paper "On a class of homogeneous spaces" in English

RSA: Danger of using p to create q

How do I deal with an unproductive colleague in a small company?

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

Find the result of this dual key cipher

What's the output of a record needle playing an out-of-speed record

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

How much of data wrangling is a data scientist's job?

Was any UN Security Council vote triple-vetoed?

Character reincarnated...as a snail

Why do I get two different answers for this counting problem?

Did Shadowfax go to Valinor?

Why is Minecraft giving an OpenGL error?

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

Which country benefited the most from UN Security Council vetoes?

I'm flying to France today and my passport expires in less than 2 months

How can I make my BBEG immortal short of making them a Lich or Vampire?



how can i create a file and add to it periodically, retaining the contents of the file


The profile of gnome-terminal isnt correctly loaded by command line startHow can I get a file's UbuntuOne URL from the terminal?How does gedit detect the encoding of a text file?does << (input redirection in append mode ) works only for newline?Need audio player for bash scriptWant to write a bash script to automate creating program filesCrontab script not running (16.04)How do I get the contents of a 1-line text file into the bash command buffer?How can I avoid having to enter a password for an scp command by hard-coding the password into my script?Creating a .bash file to test for loop






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I've looked around AskUbuntu, as well as just trying on the internet; but i can see no solution, every time i change my coding.



I run Ubuntu 18.04.1 (in case that matters)



and i want to have a simple script that will allow data to be added to a file, but if the file already exists, to allow it to continue from where it left off at the beginning.



so i want file to be created and the first piece of information put into it from a 3rd party source.



then i want now that the file already exists, i want it to add new information at the bottom of the existing text



for egg sample




  • the file does not exist

  • a file is created (called "mylog")

  • information is added to the first line of the file and a newline is
    created to move the cursor to the beginning of the next available
    line.

  • The file contains all the log information i needed by monitoring them
    for me

  • while i learn sleep patterns again.


Is this even possible on Ubuntu, Am I missing the obvious; the irony is that i can do it in DOS with my eyes closed.



Thanks in advance; please refer to similar questions if you think they will help, i personally was just not able too.



I've been trying to do it with gedit and a terminal to run it each time to test. If you can do it with bash, that would be great, if you think something better, that's perfectly acceptable, i Just use Bash because it's my favourite, but I'm not married to it.









share





























    0















    I've looked around AskUbuntu, as well as just trying on the internet; but i can see no solution, every time i change my coding.



    I run Ubuntu 18.04.1 (in case that matters)



    and i want to have a simple script that will allow data to be added to a file, but if the file already exists, to allow it to continue from where it left off at the beginning.



    so i want file to be created and the first piece of information put into it from a 3rd party source.



    then i want now that the file already exists, i want it to add new information at the bottom of the existing text



    for egg sample




    • the file does not exist

    • a file is created (called "mylog")

    • information is added to the first line of the file and a newline is
      created to move the cursor to the beginning of the next available
      line.

    • The file contains all the log information i needed by monitoring them
      for me

    • while i learn sleep patterns again.


    Is this even possible on Ubuntu, Am I missing the obvious; the irony is that i can do it in DOS with my eyes closed.



    Thanks in advance; please refer to similar questions if you think they will help, i personally was just not able too.



    I've been trying to do it with gedit and a terminal to run it each time to test. If you can do it with bash, that would be great, if you think something better, that's perfectly acceptable, i Just use Bash because it's my favourite, but I'm not married to it.









    share

























      0












      0








      0








      I've looked around AskUbuntu, as well as just trying on the internet; but i can see no solution, every time i change my coding.



      I run Ubuntu 18.04.1 (in case that matters)



      and i want to have a simple script that will allow data to be added to a file, but if the file already exists, to allow it to continue from where it left off at the beginning.



      so i want file to be created and the first piece of information put into it from a 3rd party source.



      then i want now that the file already exists, i want it to add new information at the bottom of the existing text



      for egg sample




      • the file does not exist

      • a file is created (called "mylog")

      • information is added to the first line of the file and a newline is
        created to move the cursor to the beginning of the next available
        line.

      • The file contains all the log information i needed by monitoring them
        for me

      • while i learn sleep patterns again.


      Is this even possible on Ubuntu, Am I missing the obvious; the irony is that i can do it in DOS with my eyes closed.



      Thanks in advance; please refer to similar questions if you think they will help, i personally was just not able too.



      I've been trying to do it with gedit and a terminal to run it each time to test. If you can do it with bash, that would be great, if you think something better, that's perfectly acceptable, i Just use Bash because it's my favourite, but I'm not married to it.









      share














      I've looked around AskUbuntu, as well as just trying on the internet; but i can see no solution, every time i change my coding.



      I run Ubuntu 18.04.1 (in case that matters)



      and i want to have a simple script that will allow data to be added to a file, but if the file already exists, to allow it to continue from where it left off at the beginning.



      so i want file to be created and the first piece of information put into it from a 3rd party source.



      then i want now that the file already exists, i want it to add new information at the bottom of the existing text



      for egg sample




      • the file does not exist

      • a file is created (called "mylog")

      • information is added to the first line of the file and a newline is
        created to move the cursor to the beginning of the next available
        line.

      • The file contains all the log information i needed by monitoring them
        for me

      • while i learn sleep patterns again.


      Is this even possible on Ubuntu, Am I missing the obvious; the irony is that i can do it in DOS with my eyes closed.



      Thanks in advance; please refer to similar questions if you think they will help, i personally was just not able too.



      I've been trying to do it with gedit and a terminal to run it each time to test. If you can do it with bash, that would be great, if you think something better, that's perfectly acceptable, i Just use Bash because it's my favourite, but I'm not married to it.







      command-line bash scripts gnome-terminal gedit





      share












      share










      share



      share










      asked 4 mins ago









      SPooKYiNeSSSPooKYiNeSS

      3051316




      3051316






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131609%2fhow-can-i-create-a-file-and-add-to-it-periodically-retaining-the-contents-of-th%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131609%2fhow-can-i-create-a-file-and-add-to-it-periodically-retaining-the-contents-of-th%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...