How to rename a file with different name? Announcing the arrival of Valued Associate #679:...

Disembodied hand growing fangs

How does the math work when buying airline miles?

If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?

How do I use the new nonlinear finite element in Mathematica 12 for this equation?

Hangman Game with C++

Should I use a zero-interest credit card for a large one-time purchase?

Illegal assignment from sObject to Id

What does it mean that physics no longer uses mechanical models to describe phenomena?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Amount of permutations on an NxNxN Rubik's Cube

What is the topology associated with the algebras for the ultrafilter monad?

Why do we need to use the builder design pattern when we can do the same thing with setters?

How fail-safe is nr as stop bytes?

Can an alien society believe that their star system is the universe?

How often does castling occur in grandmaster games?

What was the first language to use conditional keywords?

Sum letters are not two different

Putting class ranking in CV, but against dept guidelines

What's the meaning of "fortified infraction restraint"?

Using et al. for a last / senior author rather than for a first author

How to tell that you are a giant?

How can I reduce the gap between left and right of cdot with a macro?

Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?

Trademark violation for app?



How to rename a file with different name?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionBatch copy and rename with regexpHow to rename files and directory with *.~1~ suffix to original name?find file, copy but with different nameBatch rename “case duplicates”Copy file,create duplicates in different directory with predefined list of filenamesExtract a List of .zip files into one new directory each, directory name to be taken from name of the zip fileMove all files into subdirectories named after beginning of file nameMove all files into subdirectories named after part of file nameRemove duplicate fields with different dataWant to rename a files in folder with folder_1.txt folder_2.txt folder_n.txt name





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







0















I have a file named servername_test_LINUX_test_test_2019-04-19.xls



I have to create multiple copies of this file, with the condition that server name should be changed in each file created



e.g.



original file-name:



servername_test_LINUX_test_test_2019-04-19.xls 


newly created files names should be like this:



servername_test_LINUX_test_test_2019-04-19.xls 
test_test_LINUX_test_test_2019-04-19.xls
example_test_LINUX_test_test_2019-04-19.xls









share|improve this question









New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2





    What determines the new filenames?

    – Jesse_b
    4 hours ago











  • the tool for the job is larry wall's rename (apt-get install rename).

    – ctrl-alt-delor
    4 hours ago











  • DOTA@ that did not work.. to be more clear. i have .xls file.. like this servername_test_LINUX_test_test_2019-04-19.xls .... i have to create the same file 100 times with 100 diff server names. so the servername field should be changing for every new file created with the server list i have. ... from the script you have given.. i have created server_list file and inserted server names in it and executed it. rest all i kept same...my OS- redhat. ty

    – sanjay golla
    2 hours ago













  • "i have created server_list file" please edit your question to include a minimal sample of this file

    – steeldriver
    1 hour ago




















0















I have a file named servername_test_LINUX_test_test_2019-04-19.xls



I have to create multiple copies of this file, with the condition that server name should be changed in each file created



e.g.



original file-name:



servername_test_LINUX_test_test_2019-04-19.xls 


newly created files names should be like this:



servername_test_LINUX_test_test_2019-04-19.xls 
test_test_LINUX_test_test_2019-04-19.xls
example_test_LINUX_test_test_2019-04-19.xls









share|improve this question









New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2





    What determines the new filenames?

    – Jesse_b
    4 hours ago











  • the tool for the job is larry wall's rename (apt-get install rename).

    – ctrl-alt-delor
    4 hours ago











  • DOTA@ that did not work.. to be more clear. i have .xls file.. like this servername_test_LINUX_test_test_2019-04-19.xls .... i have to create the same file 100 times with 100 diff server names. so the servername field should be changing for every new file created with the server list i have. ... from the script you have given.. i have created server_list file and inserted server names in it and executed it. rest all i kept same...my OS- redhat. ty

    – sanjay golla
    2 hours ago













  • "i have created server_list file" please edit your question to include a minimal sample of this file

    – steeldriver
    1 hour ago
















0












0








0


1






I have a file named servername_test_LINUX_test_test_2019-04-19.xls



I have to create multiple copies of this file, with the condition that server name should be changed in each file created



e.g.



original file-name:



servername_test_LINUX_test_test_2019-04-19.xls 


newly created files names should be like this:



servername_test_LINUX_test_test_2019-04-19.xls 
test_test_LINUX_test_test_2019-04-19.xls
example_test_LINUX_test_test_2019-04-19.xls









share|improve this question









New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have a file named servername_test_LINUX_test_test_2019-04-19.xls



I have to create multiple copies of this file, with the condition that server name should be changed in each file created



e.g.



original file-name:



servername_test_LINUX_test_test_2019-04-19.xls 


newly created files names should be like this:



servername_test_LINUX_test_test_2019-04-19.xls 
test_test_LINUX_test_test_2019-04-19.xls
example_test_LINUX_test_test_2019-04-19.xls






shell files scripting rename






share|improve this question









New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 4 hours ago









ctrl-alt-delor

12.5k52663




12.5k52663






New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 5 hours ago









sanjay gollasanjay golla

1




1




New contributor




sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2





    What determines the new filenames?

    – Jesse_b
    4 hours ago











  • the tool for the job is larry wall's rename (apt-get install rename).

    – ctrl-alt-delor
    4 hours ago











  • DOTA@ that did not work.. to be more clear. i have .xls file.. like this servername_test_LINUX_test_test_2019-04-19.xls .... i have to create the same file 100 times with 100 diff server names. so the servername field should be changing for every new file created with the server list i have. ... from the script you have given.. i have created server_list file and inserted server names in it and executed it. rest all i kept same...my OS- redhat. ty

    – sanjay golla
    2 hours ago













  • "i have created server_list file" please edit your question to include a minimal sample of this file

    – steeldriver
    1 hour ago
















  • 2





    What determines the new filenames?

    – Jesse_b
    4 hours ago











  • the tool for the job is larry wall's rename (apt-get install rename).

    – ctrl-alt-delor
    4 hours ago











  • DOTA@ that did not work.. to be more clear. i have .xls file.. like this servername_test_LINUX_test_test_2019-04-19.xls .... i have to create the same file 100 times with 100 diff server names. so the servername field should be changing for every new file created with the server list i have. ... from the script you have given.. i have created server_list file and inserted server names in it and executed it. rest all i kept same...my OS- redhat. ty

    – sanjay golla
    2 hours ago













  • "i have created server_list file" please edit your question to include a minimal sample of this file

    – steeldriver
    1 hour ago










2




2





What determines the new filenames?

– Jesse_b
4 hours ago





What determines the new filenames?

– Jesse_b
4 hours ago













the tool for the job is larry wall's rename (apt-get install rename).

– ctrl-alt-delor
4 hours ago





the tool for the job is larry wall's rename (apt-get install rename).

– ctrl-alt-delor
4 hours ago













DOTA@ that did not work.. to be more clear. i have .xls file.. like this servername_test_LINUX_test_test_2019-04-19.xls .... i have to create the same file 100 times with 100 diff server names. so the servername field should be changing for every new file created with the server list i have. ... from the script you have given.. i have created server_list file and inserted server names in it and executed it. rest all i kept same...my OS- redhat. ty

– sanjay golla
2 hours ago







DOTA@ that did not work.. to be more clear. i have .xls file.. like this servername_test_LINUX_test_test_2019-04-19.xls .... i have to create the same file 100 times with 100 diff server names. so the servername field should be changing for every new file created with the server list i have. ... from the script you have given.. i have created server_list file and inserted server names in it and executed it. rest all i kept same...my OS- redhat. ty

– sanjay golla
2 hours ago















"i have created server_list file" please edit your question to include a minimal sample of this file

– steeldriver
1 hour ago







"i have created server_list file" please edit your question to include a minimal sample of this file

– steeldriver
1 hour ago












2 Answers
2






active

oldest

votes


















1














I don't know how we're deterministically determining servername (I'm just iterating through a space delimited list of servernames in $server_list), but here's maybe a skeleton you can work from:



fn='_test_LINUX_test_test_2019-04-19.xls'; for s in $server_list; do cp -a servername$fn $s$fn; done






share|improve this answer








New contributor




DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




























    0














    Exactly file name is linuxtest_test_LINUX_test_test_2019-04-19.xls..i would like to replace Linuxtest with other server names as I create new sheets. For second file. Linuxtest will become susetest for third redhattest etc






    share|improve this answer








    New contributor




    Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      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
      });


      }
      });






      sanjay golla is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513279%2fhow-to-rename-a-file-with-different-name%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 don't know how we're deterministically determining servername (I'm just iterating through a space delimited list of servernames in $server_list), but here's maybe a skeleton you can work from:



      fn='_test_LINUX_test_test_2019-04-19.xls'; for s in $server_list; do cp -a servername$fn $s$fn; done






      share|improve this answer








      New contributor




      DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.

























        1














        I don't know how we're deterministically determining servername (I'm just iterating through a space delimited list of servernames in $server_list), but here's maybe a skeleton you can work from:



        fn='_test_LINUX_test_test_2019-04-19.xls'; for s in $server_list; do cp -a servername$fn $s$fn; done






        share|improve this answer








        New contributor




        DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.























          1












          1








          1







          I don't know how we're deterministically determining servername (I'm just iterating through a space delimited list of servernames in $server_list), but here's maybe a skeleton you can work from:



          fn='_test_LINUX_test_test_2019-04-19.xls'; for s in $server_list; do cp -a servername$fn $s$fn; done






          share|improve this answer








          New contributor




          DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.










          I don't know how we're deterministically determining servername (I'm just iterating through a space delimited list of servernames in $server_list), but here's maybe a skeleton you can work from:



          fn='_test_LINUX_test_test_2019-04-19.xls'; for s in $server_list; do cp -a servername$fn $s$fn; done







          share|improve this answer








          New contributor




          DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 4 hours ago









          DotADotA

          311




          311




          New contributor




          DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          DotA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.

























              0














              Exactly file name is linuxtest_test_LINUX_test_test_2019-04-19.xls..i would like to replace Linuxtest with other server names as I create new sheets. For second file. Linuxtest will become susetest for third redhattest etc






              share|improve this answer








              New contributor




              Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                0














                Exactly file name is linuxtest_test_LINUX_test_test_2019-04-19.xls..i would like to replace Linuxtest with other server names as I create new sheets. For second file. Linuxtest will become susetest for third redhattest etc






                share|improve this answer








                New contributor




                Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  0












                  0








                  0







                  Exactly file name is linuxtest_test_LINUX_test_test_2019-04-19.xls..i would like to replace Linuxtest with other server names as I create new sheets. For second file. Linuxtest will become susetest for third redhattest etc






                  share|improve this answer








                  New contributor




                  Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Exactly file name is linuxtest_test_LINUX_test_test_2019-04-19.xls..i would like to replace Linuxtest with other server names as I create new sheets. For second file. Linuxtest will become susetest for third redhattest etc







                  share|improve this answer








                  New contributor




                  Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 1 hour ago









                  Sanjay gollaSanjay golla

                  1




                  1




                  New contributor




                  Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Sanjay golla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






















                      sanjay golla is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      sanjay golla is a new contributor. Be nice, and check out our Code of Conduct.













                      sanjay golla is a new contributor. Be nice, and check out our Code of Conduct.












                      sanjay golla is a new contributor. Be nice, and check out our Code of Conduct.
















                      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%2f513279%2fhow-to-rename-a-file-with-different-name%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

                      Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

                      The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

                      Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...