The following three methods are summarized for viewing the file created on a day of the week: 1. use the ls command in combination with grep: ls-l -- time-style & 039; & amp; 43; % A & 039; | grep-E & quot; Tuesday | Wednesday & quot; 2 use AWK Method 1: [oracle @ bys3 ~] The following three methods are summarized for $ ls to view files 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
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.