remove a word from many places in a long text file

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












Suppose I have a file with many lines of the form



date time name some stuff


where every line may be different except for 'name', which is the same every time, and I want to remove 'name' from every line: is it possible to write a short bash script to achieve this?







share|improve this question






















  • Where does "recursive" come into play here?
    – Kusalananda
    Mar 5 at 15:11















up vote
0
down vote

favorite
1












Suppose I have a file with many lines of the form



date time name some stuff


where every line may be different except for 'name', which is the same every time, and I want to remove 'name' from every line: is it possible to write a short bash script to achieve this?







share|improve this question






















  • Where does "recursive" come into play here?
    – Kusalananda
    Mar 5 at 15:11













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





Suppose I have a file with many lines of the form



date time name some stuff


where every line may be different except for 'name', which is the same every time, and I want to remove 'name' from every line: is it possible to write a short bash script to achieve this?







share|improve this question














Suppose I have a file with many lines of the form



date time name some stuff


where every line may be different except for 'name', which is the same every time, and I want to remove 'name' from every line: is it possible to write a short bash script to achieve this?









share|improve this question













share|improve this question




share|improve this question








edited Mar 5 at 15:36









Archemar

18.9k93366




18.9k93366










asked Mar 5 at 15:02









jj_p

1836




1836











  • Where does "recursive" come into play here?
    – Kusalananda
    Mar 5 at 15:11

















  • Where does "recursive" come into play here?
    – Kusalananda
    Mar 5 at 15:11
















Where does "recursive" come into play here?
– Kusalananda
Mar 5 at 15:11





Where does "recursive" come into play here?
– Kusalananda
Mar 5 at 15:11











2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










Gilles answer works but it will only remove name from standard output. If you want to remove name from the file itself then you need:



sed -i 's/name//' file






share|improve this answer



























    up vote
    4
    down vote













    Why not simply :



    sed 's/name//' file


    ?






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428292%2fremove-a-word-from-many-places-in-a-long-text-file%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      Gilles answer works but it will only remove name from standard output. If you want to remove name from the file itself then you need:



      sed -i 's/name//' file






      share|improve this answer
























        up vote
        1
        down vote



        accepted










        Gilles answer works but it will only remove name from standard output. If you want to remove name from the file itself then you need:



        sed -i 's/name//' file






        share|improve this answer






















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Gilles answer works but it will only remove name from standard output. If you want to remove name from the file itself then you need:



          sed -i 's/name//' file






          share|improve this answer












          Gilles answer works but it will only remove name from standard output. If you want to remove name from the file itself then you need:



          sed -i 's/name//' file







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 5 at 15:59









          Nasir Riley

          1,514138




          1,514138






















              up vote
              4
              down vote













              Why not simply :



              sed 's/name//' file


              ?






              share|improve this answer
























                up vote
                4
                down vote













                Why not simply :



                sed 's/name//' file


                ?






                share|improve this answer






















                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote









                  Why not simply :



                  sed 's/name//' file


                  ?






                  share|improve this answer












                  Why not simply :



                  sed 's/name//' file


                  ?







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 5 at 15:05









                  Gilles Quenot

                  15.3k13448




                  15.3k13448






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428292%2fremove-a-word-from-many-places-in-a-long-text-file%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay