Reputation: 331
I would like to know how to list a file by current date and output filename only
my current command:
ls -l /var/www/html/test --time-style=+%D | grep $(date +%D)
output:
-rwxrwxr-x 1 root test 146 04/03/18 file1.txt
-rwxrwxr-x 1 root test 146 04/03/18 file2.txt
I tried ls /var/www/html/test --time-style=+%D | grep $(date +%D)
, and it didn't work.
basically, I want the output as filename only file1.txt
and file2.txt
Upvotes: 1
Views: 1446
Reputation: 511
ls -l /var/www/html/test --time-style=+%D | grep $(date +%D) | awk '{print $7}'
edit: formatting code
Upvotes: 1