Sponsored Content
Top Forums Shell Programming and Scripting Looking for a better way to do this Post 303028179 by ae4ml on Tuesday 1st of January 2019 10:09:02 AM
Old 01-01-2019
Looking for a better way to do this

I have a script that is searching for a file with todays date as part of the file name.

This works great with a 2 digit day but here is the problem. Those first 9 days of the month .
Code:
ls -l MMDVM_Bridge-"$(date -d "0 day" "+%Y-%m-%-d")".log 
ls: cannot access 'MMDVM_Bridge-2019-01-1.log': No such file or directory

it exists as 2019-01-01

Code:
root@442400Spotsy-pi:/var/log/dvswitch# ls -l MMDVM_Bridge-2019*                             
-rw-r--r-- 1 root root 358 Jan  1 09:12 MMDVM_Bridge-2019-01-01.log

Any thoughts ?



Mike

Last edited by vbe; 01-01-2019 at 11:16 AM.. Reason: code tags
 
NNSTATS(1m)															       NNSTATS(1m)

NAME
nnstats - display nnmaster collection and expire statistics SYNOPSIS
nnstats [ -lt ] [ -d month day ] [ -m month ] [ logfile ]... DESCRIPTION
nnstats will extract the collection (C) and expiration (X) entries from the log file and calculate total and average number of articles, groups and elapsed time per day, per month, or for the duration of the whole log file. Normally only a summary for the specified period is printed. If -l is specified, the statistics for each day in the period is also printed, and if -t is specified the summary is not printed. Normally the statistics is collected for all days in the log files (or the current log file if one is not specified). If "-m month" is specified, the statistics for that month is calculated. The month is specified in normal date notation, i.e. a capital- ized three letter abbreviation like Jan, Feb, ... If "-d month day" is specified, the statistics for that date only is calculated and printed. FILES
../Log The log file SEE ALSO
nn(1), nnusage(1M), nnadmin(1M), nnmaster(8) NOTES
If nnmaster is run with options -LCX, nnstats will not work, because the necessary entries are not written to the log file. AUTHORS
Mark Moraes <moraes@csri.toronto.edu> Kim F. Storm <storm@texas.dk> 4th Berkeley Distribution Release 6.6 NNSTATS(1m)
All times are GMT -4. The time now is 09:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy