16.18 Listing Files You've Created/Edited Today
If your directory is full of files and you're trying to find out which
files you've made changes to (and created) today, here's how.
[4]
Make a shell script that stores today's date in the shell's command-line
parameters.
Pipe the output of ls -l
to an awk
script.
In the awk
script, put the month (which was the second word in the
date
output) into the awk
string variable m
.
Put the date into the awk
integer variable d
-use an integer
variable so date
outputs like
#!/bin/sh set `date` ls -l | awk "BEGIN { m = \"$2\"; d = $3 } \$5 == m && \$6 == d && \$7 ~ /:/ {print}" If your version of ls -l
gives both the file's owner and group,
change - |
|