Ls-l -- time-style command

Source: Internet
Author: User

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

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.