Results 1 to 6 of 6

Thread: How to tar-e some of the files

Hybrid View

  1. #1
    Join Date
    Aug 2020
    Beans
    3

    How to tar-e some of the files

    I have files xd100000 to xd999999
    I need to tar and bzip files files with name start xd10 contain numbers 38-101 and finish with 898
    I need to do it in comand line (bash)
    How to do it ???
    Best regards
    Norbert

  2. #2
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: How to tar-e some of the files

    Hi, norbisan!

    Is this your homework? What did you try?

    I'm not sure if I understand which files do you have to archive. Could you elaborate your question?

    What I think I understand is that the file name must begin with xd10 and must end with 898, but I'm unsure what do you mean by "contain numbers 38-101".

  3. #3
    Join Date
    Aug 2020
    Beans
    3

    Re: How to tar-e some of the files

    Hi.
    files have to start with xd10 then 38, 39, 40 .... 101 and end with 898

    other way xd10{38..101}898
    It was some kind of task with i can not solve and can not find solution.
    My idea was to use
    ls xd10{38...101}898 | xargs tar -cvf files.tar {}
    or
    tar -cvf files.tar xd00000{11...15}898

  4. #4
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: How to tar-e some of the files

    Here is a hint.

    You have an 8 character string and you know for sure 7 of them.

    Try to figure out which is the unknown and how is related to the others.

    The bash part is trivial

  5. #5
    Join Date
    Aug 2020
    Beans
    3

    Re: How to tar-e some of the files

    Hi,
    that was only example.
    The key question is about 38-101, or totally different range 1-999
    but i found solution. It was in front of me
    tar -cvf files.tar xd00000{11..15}898
    (Previous i had 3 dots and the solution are 2 dots)
    Best regards

  6. #6
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: How to tar-e some of the files

    Please don't play with our time.

    We are here to help .Please don't ask XY questions: https://mywiki.wooledge.org/XyProblem

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •