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
  • 72,889

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
  • 242,166
-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.

Dasel
  • 547
  • 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