how to make two scripts in sed. one after the other

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











up vote
0
down vote

favorite












How can we use a file to make a script in sed and then using that script again to translate the text? For example,
if we have a morse code file to be translated in sed and again use that script to translate English text to morse code.







share|improve this question





















  • Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script?
    – Philippos
    Apr 18 at 10:29














up vote
0
down vote

favorite












How can we use a file to make a script in sed and then using that script again to translate the text? For example,
if we have a morse code file to be translated in sed and again use that script to translate English text to morse code.







share|improve this question





















  • Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script?
    – Philippos
    Apr 18 at 10:29












up vote
0
down vote

favorite









up vote
0
down vote

favorite











How can we use a file to make a script in sed and then using that script again to translate the text? For example,
if we have a morse code file to be translated in sed and again use that script to translate English text to morse code.







share|improve this question













How can we use a file to make a script in sed and then using that script again to translate the text? For example,
if we have a morse code file to be translated in sed and again use that script to translate English text to morse code.









share|improve this question












share|improve this question




share|improve this question








edited Apr 18 at 10:12









Kusalananda

102k13199315




102k13199315









asked Apr 18 at 9:24









Somojel

212




212











  • Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script?
    – Philippos
    Apr 18 at 10:29
















  • Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script?
    – Philippos
    Apr 18 at 10:29















Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script?
– Philippos
Apr 18 at 10:29




Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script?
– Philippos
Apr 18 at 10:29










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Since I don't know what a morse code file is (but I remember your previous question), I suppose it would be a script like



#!/bin/sh

# Some code that creates the sed script "translate.sed"
# goes here. We can't really know how to do this because
# we don't know what a "morse code file" is.

# Run the just-created script on a file which was
# given on the command line:
sed -f translate.sed "$1"


If this script is called do_translate.sh, you would run it as



$ ./do_translate.sh text_file.txt


where text_file.txt is a file that you would want to translate into Morse code.



However, it seems strange that you would want to create the sed script every time you run the above script. I would probably create translate.sed once and for all and use that directly, as I mentioned in my previous reply to you.






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%2f438464%2fhow-to-make-two-scripts-in-sed-one-after-the-other%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Since I don't know what a morse code file is (but I remember your previous question), I suppose it would be a script like



    #!/bin/sh

    # Some code that creates the sed script "translate.sed"
    # goes here. We can't really know how to do this because
    # we don't know what a "morse code file" is.

    # Run the just-created script on a file which was
    # given on the command line:
    sed -f translate.sed "$1"


    If this script is called do_translate.sh, you would run it as



    $ ./do_translate.sh text_file.txt


    where text_file.txt is a file that you would want to translate into Morse code.



    However, it seems strange that you would want to create the sed script every time you run the above script. I would probably create translate.sed once and for all and use that directly, as I mentioned in my previous reply to you.






    share|improve this answer

























      up vote
      0
      down vote













      Since I don't know what a morse code file is (but I remember your previous question), I suppose it would be a script like



      #!/bin/sh

      # Some code that creates the sed script "translate.sed"
      # goes here. We can't really know how to do this because
      # we don't know what a "morse code file" is.

      # Run the just-created script on a file which was
      # given on the command line:
      sed -f translate.sed "$1"


      If this script is called do_translate.sh, you would run it as



      $ ./do_translate.sh text_file.txt


      where text_file.txt is a file that you would want to translate into Morse code.



      However, it seems strange that you would want to create the sed script every time you run the above script. I would probably create translate.sed once and for all and use that directly, as I mentioned in my previous reply to you.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Since I don't know what a morse code file is (but I remember your previous question), I suppose it would be a script like



        #!/bin/sh

        # Some code that creates the sed script "translate.sed"
        # goes here. We can't really know how to do this because
        # we don't know what a "morse code file" is.

        # Run the just-created script on a file which was
        # given on the command line:
        sed -f translate.sed "$1"


        If this script is called do_translate.sh, you would run it as



        $ ./do_translate.sh text_file.txt


        where text_file.txt is a file that you would want to translate into Morse code.



        However, it seems strange that you would want to create the sed script every time you run the above script. I would probably create translate.sed once and for all and use that directly, as I mentioned in my previous reply to you.






        share|improve this answer













        Since I don't know what a morse code file is (but I remember your previous question), I suppose it would be a script like



        #!/bin/sh

        # Some code that creates the sed script "translate.sed"
        # goes here. We can't really know how to do this because
        # we don't know what a "morse code file" is.

        # Run the just-created script on a file which was
        # given on the command line:
        sed -f translate.sed "$1"


        If this script is called do_translate.sh, you would run it as



        $ ./do_translate.sh text_file.txt


        where text_file.txt is a file that you would want to translate into Morse code.



        However, it seems strange that you would want to create the sed script every time you run the above script. I would probably create translate.sed once and for all and use that directly, as I mentioned in my previous reply to you.







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Apr 18 at 9:34









        Kusalananda

        102k13199315




        102k13199315






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f438464%2fhow-to-make-two-scripts-in-sed-one-after-the-other%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?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?