Skip to content

Instantly share code, notes, and snippets.

@suchoudh
Created June 5, 2020 11:51
Show Gist options
  • Select an option

  • Save suchoudh/3918786f69a3645d44da1f421a5d0a09 to your computer and use it in GitHub Desktop.

Select an option

Save suchoudh/3918786f69a3645d44da1f421a5d0a09 to your computer and use it in GitHub Desktop.
find and replace recursively in direcoty
74 Script done on 2020-06-04 12:57:09+0530
75 find . -name *.txt -not -path '*/\.*' -print0 | xargs -0 -exec l s -la {} +
76 find . -name *.txt -not -path '*/\.*' -print0 | xargs -0 sed -i 's/#/~/g'
77
78 -exec rename _dbg.txt .txt '{}' \;
79
80
81
82 Find txt files and rename them to be md
83
84 find . -name "*.txt" -exec rename 's/\.txt$/.md/' '{}' \;
~
@suchoudh
Copy link
Author

suchoudh commented Jun 6, 2020

find . -name ".txt" -not -path '/.' -print0 | xargs -0 -exec ls -la {} + >> find_ls_la.txt 1
find . -name "_
." -not -path '/.' -not -path '703' -print0 | xargs -0 -exec ls
find . -name "_
.md" -not -path '/.' -not -path '703' -print0 | xargs -0 -exec rename 's/_.md$/1.*/' '{}' ; # BLOCK BUSTER FAIL

saaaf kardi # Jai gandhi baba .. Actually what did Ghandhi do .. its your doing. ... be ready to own up your shi%T

find . -name "_.md" -not -path '/.' -not -path '703' -print0 | xargs -0 -exec rename 's/_.md$/1*.*/' '{}' ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment