Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
find [folder] -type f | xargs -I {} grep -li "text" {}

find [folder] -type f                  # search the specified folder for all files, returns full path of each file
    | xargs -I {} grep -li "[text]" {} # piped into xargs to grep for all files containing specified text ignoring case
Warning

More details should be added for this xargs command or if possible rewrite it in a way that is more clear.

Search & Replace Inside of Files

...

Code Block
languagebash
find [folder] -type f | xargs -I {} grep -li "text" {} | xargs perl -pi -e 's/[text_to_search_for]/[text_to_search_for]/g'

find [folder] -type f                  # search the specified folder for all files, returns full path of each file
    | xargs -I {} grep -li "[text]" {} # piped into xargs with to grep for all files containing specified text ignoring case}
    | xargs perl -pi -e 's/[text_to_search_for]/[text_to_replace_with]/g' # pipe list of files and search/using perl search and replace with specified text}
Warning

More details should be added for this xargs command or if possible rewrite it in a way that is more clear.

Disk Management

List directories from largest to smallest at the top level only.

...