Wildcard in bash script

前端 未结 2 820
梦谈多话
梦谈多话 2021-01-28 01:58

I have a bash script to retrieve files from ftp.

Now the files have one part a date string in the filename, but also undefined numbers that changes on every file. I want

2条回答
  •  花落未央
    2021-01-28 02:42

    With the ? characters you include not only numbers, but any character. So if you want to include only numbers, you can replace the ??? characters with [0-9][0-9][0-9].

    Example:

    If you have the following files:

    $ ls 0123vel.h5 0333vel.h5 033vel.h5 0pecvel.h5

    with this ls you show the correct files:

    $ ls 0[0-9][0-9][0-9]vel.radar.h5 0123vel.h5 0333vel.h5

提交回复
热议问题