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
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
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".
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.
ls t_test_[0-9]*
? – terdon Feb 08 '21 at 10:55