Unix/Linux Go Back    



Find command + replace the extension (.xxx) by *

UNIX for Beginners Questions & Answers




Kindly Note - This is a Single User Post by Forum Member MadeInGermany Regarding:
Find command + replace the extension (.xxx) by *.
Please Follow The Primary Link Above to View the Full Discussion.

   
Old Unix and Linux 04-21-2017   -   Original Discussion by royinfo.alain
MadeInGermany MadeInGermany is offline Forum Staff  
Moderator
 
Join Date: May 2012
Last Activity: 21 November 2017, 8:56 PM EST
Location: Simplicity
Posts: 3,826
Thanks: 319
Thanked 1,283 Times in 1,161 Posts
... or the script is run with "sh -x"; the -x option also turns on the debug mode.

The following will run faster, and log less in debug mode

Code:
find * -type f -mtime -365 |
# replace a trailing .xxx with *
  sed 's/[.][^.]*$//' |
# Remove duplicates
  sort -u > $MAITUT/BCK_DATA_FILES_TO_DELETE

The pipe passes the output to the next command without a temp file.
The Following User Says Thank You to MadeInGermany For This Useful Post:
royinfo.alain (04-21-2017)