9/5/2023 0 Comments Select multiple files at once![]() ![]() ![]() Let’s say we want to delete the log files older than 35 days.īefore we show the awk command, let’s have a look at the date command to calculate the date 35 days ago: # the current date: Similarly, we can also pass the output of the awk command to xargs and rm: We’ve learned to use the find | xargs combination to remove files found by the find command. But it’s straightforward to get those files using the awk command: $ awk -F'.' -v from='' -v to='' '$3>=from & $3=from & $3<=to’: This is pretty easy to understand - we take the log files covered by the time range and print the filenamesĪfter we have the files to delete, the next step will be executing the actual deletion operation on the files. Let’s say we want to delete the log files between -29.įinding log files in a date range isn’t easy to solve using the pattern matching techniques we’ve learned so far.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |