The following three methods are summarized to view how files are created on a day of the week:
1. Use the ls command in combination with grep:
Ls-l -- time-style '+ % a' | grep-E "Tuesday | Wednesday"
2. Use AWK Method 1:
[Oracle @ bys3 ~] $ Ls-l -- time-style '+ % a' | awk' $6 = "Friday" | $6 = "Tuesday" {print $0 }'
-Rw-r -- 1 oracle oinstall 253 Friday archback. sh
-Rw-r -- 1 oracle oinstall 199 Friday bbedfile.txt
-Rw-r ----- 1 oracle oinstall 1958583 Friday bys3_ora_1301_trc
-Rw-r -- 1 oracle oinstall 350 Tuesday delarch. sh
Drwxr-xr-x 3 oracle oinstall 4096 Tuesday oradiag_oracle
[Oracle @ bys3 ~] $
3. Use AWK Method 2: -- a little complicated
Declare-a array
Array = ('LS-l -- time-style' + % a' | awk '{print $6 }'')
Echo $ {array [0]}
Length =$ {# array [@]}
Echo $ length
For (I = 0; I <$ length; I ++ ))
Do
Case $ {array [$ I]} in Tuesday | Wednesday)
Ls-l -- time-style '+ % a' | grep-E $ {array [$ I]}
Esac
Done
~
4. Examples of the ls-l -- time-style command: -- common environment variables can be written as alias ls =''
[Oracle @ bys3 ~] $ Ls-l -- time-style = "+ % Y-% m-% d $ newline % m-% d % H: % M" -- displays detailed year, month, day, And hour
Total 1964
-Rw-r -- 1 oracle oinstall 17 2013-12-04 12-04 10
Lrwxrwxrwx 1 oracle oinstall 46 2013-12-01 12-01 22: 53alert_bys3.log->/u01/diag/rdbms/bys3/bys3/trace/alert_bys3.log
-Rw-r -- 1 oracle oinstall 253 11-15 archback. sh
[Oracle @ bys3 ~] $ Ls-l -- time-style = "iso"
Total 1964
-Rw-r -- 1 oracle oinstall 17 12-04 14:09 10
Lrwxrwxrwx 1 oracle oinstall 46 12-01 alert_bys3.log->/u01/diag/rdbms/bys3/bys3/trace/alert_bys3.log
-Rw-r -- 1 oracle oinstall 253 11-15 archback. sh
[Oracle @ bys3 ~] $ Ls-l -- time-style = "+ % B % e % Y $ newline % B % e % H: % M"
Total 1964
-Rw-r -- 1 oracle oinstall 17 Dec 4 2013Dec 4 10
Lrwxrwxrwx 1 oracle oinstall 46 Dec 1 2013Dec 1 22: 53alert_bys3.log->/u01/diag/rdbms/bys3/bys3/trace/alert_bys3.log
-Rw-r -- 1 oracle oinstall 253 Nov 15 2013Nov 15 archback. sh
[Oracle @ bys3 ~] $ Ls-l -- time-style = "locale"
Total 1964
-Rw-r -- 1 oracle oinstall 17 Dec 4 10
Lrwxrwxrwx 1 oracle oinstall 46 Dec 1 alert_bys3.log->/u01/diag/rdbms/bys3/bys3/trace/alert_bys3.log
-Rw-r -- 1 oracle oinstall 253 Nov 15 archback. sh