Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:35:32+00:00 2026-06-13T18:35:32+00:00

I have files: x0001_test.xml z0054_test.xml k5487_test.xml …. I would like to save them doing

  • 0

I have files: x0001_test.xml z0054_test.xml k5487_test.xml….

I would like to save them doing something like: cp *_test.xml ${BEGINNING}_test.xml.SAVE.

Is there a way in bash script to store the content of * for each file in order to re-inject it after? Or should I use a loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:35:33+00:00Added an answer on June 13, 2026 at 6:35 pm

    A loop to do that is probably trivial enough to not need a separate one-line command. You don’t need to save a portion of the filename since you’re just adding .SAVE to the whole thing:

    for fspec in *_test.xml; do
        cp "${fspec}" "${fspec}.SAVE"
    done
    

    And, in any case, you can do it in one line if you really want:

    for fspec in *_test.xml; do cp "${fspec}" "${fspec}.SAVE" ; done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have files served like so: AJAX request handler -> Include file I would
I have files that are named like C1_1_B_(1)IMG1511.jpg and I want to split them
I have an app which shows html files from assets folder. I would like
I have files with the words written on different speaking languages. I would like
I have files in a directory. I would like to know if it’s possible
I have files with various names. I know their endings, like: ....known_file_end.mat. I would
I have files which is something like : dslkj20111104-BATCH2244_20111113-091347.txt I only need dslkj and
I would like to have files named for example: dd.mm.yyyy.log How is this possible
I have files with the extension .php and I'd like to hide them, as
I would like to create a tar archive in Java. I have files which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.