0

I have two csv files example

t_test_yyyyymmdd.csv
t_test_type_yyyyymmdd.csv

I want to make the command ls to search only the file t_test_yyyyymmdd.csv

muru
  • 69,900
  • 13
  • 192
  • 292
rauyan_13
  • 3
  • 1

2 Answers2

0

If you want to list all files whose name starts with t_test_ and then has a number, you can use:

ls t_test_[0-9]*

The [0-9] is a character class that matches any number, and the * means "one or more times".

terdon
  • 234,489
  • 66
  • 447
  • 667
-2

Have you considered using the |grep command to help your ls?

For example:

ls |grep t_test_type_yyyyymmdd.csv

grep is a very powerful tool for these kind of checks; more information about the grep command here: https://www.redhat.com/sysadmin/how-to-use-grep.

schrodingerscatcuriosity
  • 12,087
  • 3
  • 29
  • 57
Dasel
  • 537
  • 3
  • 9
  • Please, not!! --> https://unix.stackexchange.com/questions/128985/why-not-parse-ls-and-what-to-do-instead – pLumo Feb 08 '21 at 11:02