Mac OSX sed - removing a string containing a dot from multiple files

Multi tool use
Multi tool use

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











up vote
0
down vote

favorite












Trying to remove a string across multiple files in a directory with sed. The folder contains a large amount of sql files, all with table names that I need to remove. For instance, one of the files looks like this:



INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (1, 1, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (2, 2, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (3, 3, 'Default', 1);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (4, 4, 'Default', 1);


I need to remove staging. from all lines. I've tried the following from the directory where the files are:



sed -i 's/staging.//g' *
sed -i 's/staging.//g' *
sed -i 's|staging.||g' *


But receive the following:



sed: 1: "eav_attribute_set ...": unterminated substitute pattern









share|improve this question



















  • 1




    Hmmm... That error message does not correspond in any way to the commands that you've been trying.
    – Kusalananda
    Aug 28 at 19:22






  • 1




    your tag states "osx" but your title states "Linux". Their sed implementations are different, which one are you using?
    – Kevin Kruse
    Aug 28 at 19:22










  • I'm using macos terminal. I've updated my question/title. Good eyes!
    – mindfullsilence
    Aug 28 at 19:54















up vote
0
down vote

favorite












Trying to remove a string across multiple files in a directory with sed. The folder contains a large amount of sql files, all with table names that I need to remove. For instance, one of the files looks like this:



INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (1, 1, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (2, 2, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (3, 3, 'Default', 1);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (4, 4, 'Default', 1);


I need to remove staging. from all lines. I've tried the following from the directory where the files are:



sed -i 's/staging.//g' *
sed -i 's/staging.//g' *
sed -i 's|staging.||g' *


But receive the following:



sed: 1: "eav_attribute_set ...": unterminated substitute pattern









share|improve this question



















  • 1




    Hmmm... That error message does not correspond in any way to the commands that you've been trying.
    – Kusalananda
    Aug 28 at 19:22






  • 1




    your tag states "osx" but your title states "Linux". Their sed implementations are different, which one are you using?
    – Kevin Kruse
    Aug 28 at 19:22










  • I'm using macos terminal. I've updated my question/title. Good eyes!
    – mindfullsilence
    Aug 28 at 19:54













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Trying to remove a string across multiple files in a directory with sed. The folder contains a large amount of sql files, all with table names that I need to remove. For instance, one of the files looks like this:



INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (1, 1, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (2, 2, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (3, 3, 'Default', 1);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (4, 4, 'Default', 1);


I need to remove staging. from all lines. I've tried the following from the directory where the files are:



sed -i 's/staging.//g' *
sed -i 's/staging.//g' *
sed -i 's|staging.||g' *


But receive the following:



sed: 1: "eav_attribute_set ...": unterminated substitute pattern









share|improve this question















Trying to remove a string across multiple files in a directory with sed. The folder contains a large amount of sql files, all with table names that I need to remove. For instance, one of the files looks like this:



INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (1, 1, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (2, 2, 'Default', 2);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (3, 3, 'Default', 1);
INSERT INTO staging.eav_attribute_set (attribute_set_id, entity_type_id, attribute_set_name, sort_order) VALUES (4, 4, 'Default', 1);


I need to remove staging. from all lines. I've tried the following from the directory where the files are:



sed -i 's/staging.//g' *
sed -i 's/staging.//g' *
sed -i 's|staging.||g' *


But receive the following:



sed: 1: "eav_attribute_set ...": unterminated substitute pattern






sed osx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 5 at 2:23









Rui F Ribeiro

36.7k1271117




36.7k1271117










asked Aug 28 at 19:15









mindfullsilence

1032




1032







  • 1




    Hmmm... That error message does not correspond in any way to the commands that you've been trying.
    – Kusalananda
    Aug 28 at 19:22






  • 1




    your tag states "osx" but your title states "Linux". Their sed implementations are different, which one are you using?
    – Kevin Kruse
    Aug 28 at 19:22










  • I'm using macos terminal. I've updated my question/title. Good eyes!
    – mindfullsilence
    Aug 28 at 19:54













  • 1




    Hmmm... That error message does not correspond in any way to the commands that you've been trying.
    – Kusalananda
    Aug 28 at 19:22






  • 1




    your tag states "osx" but your title states "Linux". Their sed implementations are different, which one are you using?
    – Kevin Kruse
    Aug 28 at 19:22










  • I'm using macos terminal. I've updated my question/title. Good eyes!
    – mindfullsilence
    Aug 28 at 19:54








1




1




Hmmm... That error message does not correspond in any way to the commands that you've been trying.
– Kusalananda
Aug 28 at 19:22




Hmmm... That error message does not correspond in any way to the commands that you've been trying.
– Kusalananda
Aug 28 at 19:22




1




1




your tag states "osx" but your title states "Linux". Their sed implementations are different, which one are you using?
– Kevin Kruse
Aug 28 at 19:22




your tag states "osx" but your title states "Linux". Their sed implementations are different, which one are you using?
– Kevin Kruse
Aug 28 at 19:22












I'm using macos terminal. I've updated my question/title. Good eyes!
– mindfullsilence
Aug 28 at 19:54





I'm using macos terminal. I've updated my question/title. Good eyes!
– mindfullsilence
Aug 28 at 19:54











2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










With FreeBSD sed (as found on macOS), you need:



sed -i '' 's/staging.//g' ./*





share|improve this answer





























    up vote
    0
    down vote













    This going to remove staging. in your file.



    cat $yourfile | sed 's/staging.//g' > tmp && mv tmp $yourfile





    share|improve this answer


















    • 1




      That unescaped . will match any character.
      – RudiC
      Aug 28 at 20:15










    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%2f465368%2fmac-osx-sed-removing-a-string-containing-a-dot-from-multiple-files%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
    2
    down vote



    accepted










    With FreeBSD sed (as found on macOS), you need:



    sed -i '' 's/staging.//g' ./*





    share|improve this answer


























      up vote
      2
      down vote



      accepted










      With FreeBSD sed (as found on macOS), you need:



      sed -i '' 's/staging.//g' ./*





      share|improve this answer
























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        With FreeBSD sed (as found on macOS), you need:



        sed -i '' 's/staging.//g' ./*





        share|improve this answer














        With FreeBSD sed (as found on macOS), you need:



        sed -i '' 's/staging.//g' ./*






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 29 at 5:55

























        answered Aug 28 at 20:31









        Stéphane Chazelas

        285k53526866




        285k53526866






















            up vote
            0
            down vote













            This going to remove staging. in your file.



            cat $yourfile | sed 's/staging.//g' > tmp && mv tmp $yourfile





            share|improve this answer


















            • 1




              That unescaped . will match any character.
              – RudiC
              Aug 28 at 20:15














            up vote
            0
            down vote













            This going to remove staging. in your file.



            cat $yourfile | sed 's/staging.//g' > tmp && mv tmp $yourfile





            share|improve this answer


















            • 1




              That unescaped . will match any character.
              – RudiC
              Aug 28 at 20:15












            up vote
            0
            down vote










            up vote
            0
            down vote









            This going to remove staging. in your file.



            cat $yourfile | sed 's/staging.//g' > tmp && mv tmp $yourfile





            share|improve this answer














            This going to remove staging. in your file.



            cat $yourfile | sed 's/staging.//g' > tmp && mv tmp $yourfile






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 28 at 20:29

























            answered Aug 28 at 20:00









            Javier Salas

            1115




            1115







            • 1




              That unescaped . will match any character.
              – RudiC
              Aug 28 at 20:15












            • 1




              That unescaped . will match any character.
              – RudiC
              Aug 28 at 20:15







            1




            1




            That unescaped . will match any character.
            – RudiC
            Aug 28 at 20:15




            That unescaped . will match any character.
            – RudiC
            Aug 28 at 20:15

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465368%2fmac-osx-sed-removing-a-string-containing-a-dot-from-multiple-files%23new-answer', 'question_page');

            );

            Post as a guest













































































            9tUBi9TAC p fLKqjK1B5slAes0HxV,9QS,UiIHS00nK3a wUzsr 6aBy08yZRXLvQ9gwJ 4f41Ww1KsHEDFH41arSAumk2MpX4Zhv
            6puSq1q7MkjaE,r8des2cUWc bqm GmpTECmbusTU,S3OI0Mh99LL6a758Ja,MujL0T

            Popular posts from this blog

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

            How many registers does an x86_64 CPU actually have?

            Displaying single band from multi-band raster using QGIS