Alright, well I did some more research since I originally posted this thread, and as much as I'd like to delete it, I can't, so I'll just extend my initial question a little.
Right now I have 3 scripts:
1
#!/bin/bash
# script1 - Write all files modfied x days ago
find .. -daystart -mtime 0 -type f | xargs ls -sSh > data_170611
2
#!/bin/bash
# script2 - Write all files modified x days ago and remove leading spaces
find .. -daystart -mtime 0 -type f | xargs ls -sSh > data_170611
sed 's/^ *//' data_170611 > data_170611_1
3
#!/bin/bash
# script3 - Write all files modified x days ago, remove leading spaces and write changes to two lists
find .. -daystart -mtime 0 -type f | xargs ls -sSh > data_170611
sed 's/^ *//' data_170611 > data_170611_1
find .. -daystart -mtime 0 -type f | xargs ls -sSh > data_200611
sed 's/^ *//' data_200611 > data_200611_1
awk '{if(FNR==NR) {arr[$0]++;next} if($0 in arr) { arr[$0]--; if (arr[$0] == 0) delete arr[$0];next}{print $0 >"FYes"}} END {for(i in arr){print i >"FTod"}}' data_200611_1 data_170611_1
Each new one is obviously just an extension of the old one. FYes and FTod are just my abbreviations for "Flagged Today" and "Flagged Yesterday" as there are two output files.
I have a few questions people may be able to answer:
- The files that i named data_170611 and data_200611 are just files of data that refer to a date.
Ideally I would like to somehow get the script to grab that date and add it after data_ so I don't have to manually edit my script each day.
EDIT
Using
DATE=`date +%d%m%y`
I now have todays date ^.^
Also found what I consider a 'weird' way of formatting that date to show 1 day prior...
DDMMYY=`date --date='1 day ago' +%d%m%y`
- My sed command requires me to write to a new file, is there a way to just overwrite it? I have tried just using data_170611 > data_170611 but that results in a blank file.
any ideas?
