How to combine two text formatting commands into one? The Next CEO of Stack Overflowcombine text files column-wiseRun two commands on one argument (without scripting)combine two text files with adding some separator between?How can I append and prepend text to single line text output and save it all to one file?Combine two greps into a single commandCombine SED commandsI'd like to use one of three commands sed (number ranges)How to insert text alternatively from two files with a common patternCombine two file into one fileCombine files into one

Does the Brexit deal have to be agreed by both Houses?

How do I construct this japanese bowl?

How do we know the LHC results are robust?

How to use tikz in fbox?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

What is the purpose of the Evocation wizard's Potent Cantrip feature?

How long to clear the 'suck zone' of a turbofan after start is initiated?

Why does standard notation not preserve intervals (visually)

Is HostGator storing my password in plaintext?

Removing read access from a file

Why Were Madagascar and New Zealand Discovered So Late?

forest, changing `s sep` such that it is at each second end node larger?

Is it okay to store user locations?

What is meant by a M next to a roman numeral?

Increase performance creating Mandelbrot set in python

How to count occurrences of text in a file?

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

Is it a good idea to use COLUMN AS (left([Another_Column],(4)) instead of LEFT in the select?

Can a single photon have an energy density?

What is the difference between "behavior" and "behaviour"?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Opposite of a diet

Why did we only see the N-1 starfighters in one film?

When airplanes disconnect from a tanker during air to air refueling, why do they bank so sharply to the right?



How to combine two text formatting commands into one?



The Next CEO of Stack Overflowcombine text files column-wiseRun two commands on one argument (without scripting)combine two text files with adding some separator between?How can I append and prepend text to single line text output and save it all to one file?Combine two greps into a single commandCombine SED commandsI'd like to use one of three commands sed (number ranges)How to insert text alternatively from two files with a common patternCombine two file into one fileCombine files into one










0















How does one combine two commands like the ones shown below into one command with one output file?



first command:



printf '%sn' 001..500 input > output


second command:



sed 's/^/PREFIX /; s/$/ SUFFIX/' input > output









share|improve this question


























    0















    How does one combine two commands like the ones shown below into one command with one output file?



    first command:



    printf '%sn' 001..500 input > output


    second command:



    sed 's/^/PREFIX /; s/$/ SUFFIX/' input > output









    share|improve this question
























      0












      0








      0








      How does one combine two commands like the ones shown below into one command with one output file?



      first command:



      printf '%sn' 001..500 input > output


      second command:



      sed 's/^/PREFIX /; s/$/ SUFFIX/' input > output









      share|improve this question














      How does one combine two commands like the ones shown below into one command with one output file?



      first command:



      printf '%sn' 001..500 input > output


      second command:



      sed 's/^/PREFIX /; s/$/ SUFFIX/' input > output






      text-processing sed command-line command text-formatting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Anonymous UserAnonymous User

      336




      336




















          2 Answers
          2






          active

          oldest

          votes


















          1














          I realise you've answered your question, but a simpler solution would be to put the prefix and suffix in the printf command.



          printf 'PREFIX %s SUFFIXn' 001..500 > output


          (I'm not sure if the input part should be there. It's absent in your answer.)






          share|improve this answer

























          • Oh even better! Awesome, thanks! p.s. You just taught me something... :)

            – Anonymous User
            yesterday












          • How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

            – Anonymous User
            yesterday











          • The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

            – Sparhawk
            yesterday












          • because it doesn't actually need the input, it works fine without.

            – Anonymous User
            yesterday











          • Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

            – Sparhawk
            yesterday



















          0














          I figured it out!



          Both commands as one:



          printf '%sn' 001..500 | sed 's/^/PREFIX /; s/$/ SUFFIX/' > output





          share|improve this answer




















          • 1





            Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

            – John1024
            yesterday











          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2funix.stackexchange.com%2fquestions%2f508877%2fhow-to-combine-two-text-formatting-commands-into-one%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I realise you've answered your question, but a simpler solution would be to put the prefix and suffix in the printf command.



          printf 'PREFIX %s SUFFIXn' 001..500 > output


          (I'm not sure if the input part should be there. It's absent in your answer.)






          share|improve this answer

























          • Oh even better! Awesome, thanks! p.s. You just taught me something... :)

            – Anonymous User
            yesterday












          • How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

            – Anonymous User
            yesterday











          • The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

            – Sparhawk
            yesterday












          • because it doesn't actually need the input, it works fine without.

            – Anonymous User
            yesterday











          • Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

            – Sparhawk
            yesterday
















          1














          I realise you've answered your question, but a simpler solution would be to put the prefix and suffix in the printf command.



          printf 'PREFIX %s SUFFIXn' 001..500 > output


          (I'm not sure if the input part should be there. It's absent in your answer.)






          share|improve this answer

























          • Oh even better! Awesome, thanks! p.s. You just taught me something... :)

            – Anonymous User
            yesterday












          • How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

            – Anonymous User
            yesterday











          • The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

            – Sparhawk
            yesterday












          • because it doesn't actually need the input, it works fine without.

            – Anonymous User
            yesterday











          • Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

            – Sparhawk
            yesterday














          1












          1








          1







          I realise you've answered your question, but a simpler solution would be to put the prefix and suffix in the printf command.



          printf 'PREFIX %s SUFFIXn' 001..500 > output


          (I'm not sure if the input part should be there. It's absent in your answer.)






          share|improve this answer















          I realise you've answered your question, but a simpler solution would be to put the prefix and suffix in the printf command.



          printf 'PREFIX %s SUFFIXn' 001..500 > output


          (I'm not sure if the input part should be there. It's absent in your answer.)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          SparhawkSparhawk

          10.3k744101




          10.3k744101












          • Oh even better! Awesome, thanks! p.s. You just taught me something... :)

            – Anonymous User
            yesterday












          • How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

            – Anonymous User
            yesterday











          • The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

            – Sparhawk
            yesterday












          • because it doesn't actually need the input, it works fine without.

            – Anonymous User
            yesterday











          • Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

            – Sparhawk
            yesterday


















          • Oh even better! Awesome, thanks! p.s. You just taught me something... :)

            – Anonymous User
            yesterday












          • How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

            – Anonymous User
            yesterday











          • The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

            – Sparhawk
            yesterday












          • because it doesn't actually need the input, it works fine without.

            – Anonymous User
            yesterday











          • Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

            – Sparhawk
            yesterday

















          Oh even better! Awesome, thanks! p.s. You just taught me something... :)

          – Anonymous User
          yesterday






          Oh even better! Awesome, thanks! p.s. You just taught me something... :)

          – Anonymous User
          yesterday














          How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

          – Anonymous User
          yesterday





          How come the sed command changed to look more simple? How is that possible? Is that like printf's equivalent?

          – Anonymous User
          yesterday













          The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

          – Sparhawk
          yesterday






          The sed command replaces the beginning ^ and end $ of each line. printf defines how it will "print" the numbers, i.e. each line consist of PREFIX followed by a string %s, then ` SUFFIX` and a newline n. The numbers expanded from 001..500 replace the string placeholder %s.

          – Sparhawk
          yesterday














          because it doesn't actually need the input, it works fine without.

          – Anonymous User
          yesterday





          because it doesn't actually need the input, it works fine without.

          – Anonymous User
          yesterday













          Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

          – Sparhawk
          yesterday






          Regarding input, if this is present, the command will create another line after the numbers, but with the literal string input instead. (I'm presuming you don't want this.)

          – Sparhawk
          yesterday














          0














          I figured it out!



          Both commands as one:



          printf '%sn' 001..500 | sed 's/^/PREFIX /; s/$/ SUFFIX/' > output





          share|improve this answer




















          • 1





            Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

            – John1024
            yesterday















          0














          I figured it out!



          Both commands as one:



          printf '%sn' 001..500 | sed 's/^/PREFIX /; s/$/ SUFFIX/' > output





          share|improve this answer




















          • 1





            Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

            – John1024
            yesterday













          0












          0








          0







          I figured it out!



          Both commands as one:



          printf '%sn' 001..500 | sed 's/^/PREFIX /; s/$/ SUFFIX/' > output





          share|improve this answer















          I figured it out!



          Both commands as one:



          printf '%sn' 001..500 | sed 's/^/PREFIX /; s/$/ SUFFIX/' > output






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          Anonymous UserAnonymous User

          336




          336







          • 1





            Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

            – John1024
            yesterday












          • 1





            Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

            – John1024
            yesterday







          1




          1





          Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

          – John1024
          yesterday





          Simpler: printf 'PREFIX %s SUFFIXn' 001..500 >output

          – John1024
          yesterday

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • 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%2funix.stackexchange.com%2fquestions%2f508877%2fhow-to-combine-two-text-formatting-commands-into-one%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

          getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

          Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

          Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.