Answer the question
In order to leave comments, you need to log in
Is it possible to do this in bash, and if so, how?
We need a bash script that for all files in the temporary directory that were created for the current month and did not change during the week, when the test line is in them, it will change it to tset.
Help me please. I want to understand the point.
Answer the question
In order to leave comments, you need to log in
The point is very simple.
Take the current date, calculate a range equal to a week (date can do this)
Find all files with a creation date such and such and a modification date no greater than such and such (find can do this)
And for each of them perform a search-and-replace (sed can do this ) ), well, for aesthetics, you can first grep the desired line, if not, do not call sed.
bash is needed here just to bring it all together.
In general, this is not possible! ;(
At least since the file system does not store the creation time ;((((((
Only available
Changed:
Moduvied:
Accessed:
find .
search from the current folder and below recursively. -type f
only files -mtime -7
modified in the last seven days. -exec Команда {}" \;
execute the command with the found file (loop) sed -i 's/test2/test21/g
- find the line test and replace it with test21 patch
or diff
harder but it will suit you for suregit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question