grep Word and Date from file
I run this command and It lets me know that my backups passed
# grep -R PASSED /usr/lib/edge/lists/simple_job/edge_summary.txt Backup Type [Status] = Master [PASSED!] Verify Type [Status] = Level-2 (Bit) [PASSED!] I also need to know the time that this file was last updated. # l edge_summary.txt -rwxr-xr-x 1 root root 2911 Dec 5 18:30 edge_summary.txt or in the file its self it has a time and date: Backup Time = 2013-12-05 18:30:04 Message Time = 2013-12-05 18:30:45 someway I could maybe use grep to look at this date/time too, but the l edge_summary.log may be an easier way. . |
Code:
$ grep 'PASSED\|Time' /usr/lib/edge/lists/simple_job/edge_summary.txt |
Quote:
Is there a way to use grep to see the permissions on a file? for example in a certain dir I need all files to be chmod 666 or higher > -rw-rw-rw- sometimes theses files permisson get changed, is there a way to run a grep command to look at the permissions and if it ever finds a file that is below 666 it will run chmod ugo+rw /appl/foodconnex/output/* > this way it will not effect files and folders higher then 666 but it will move ever file below 666 to 666. |
i think the man page for test allows you to check for permissions. you will probably need to construct a shell script to handle the rules/exceptions for your situation.
its probably just easier to change the perms to 666 no matter what they are... its like switching on a lite (theres no need to check if it is on, and then turn it on). |
Quote:
Code:
find /appl/foodconnex/output/ -type f ! -perm -666 -exec chmod 666 {} \; |
Quote:
|
Quote:
Code:
chmod 666 *.txt edit: i'll answer my own question with what was previosly quoted- no, because: Quote:
|
Quote:
Thank you command works perfectly find /appl/foodconnex/output/ -type f ! -perm -666 -exec chmod ugo+rw /appl/foodconnex/output/ {} \; (I use chmod ugo+rw just to be safe so no files over 666 will be touched even though the find command does that any way) |
You're welcome
Also, 2nd part of path is not required. |
All times are GMT -5. The time now is 07:56 AM. |