Forrest logo
back to the fastmod tool

fastmod:tldr:9ab27

fastmod: Replace a regex pattern in a specific directory in files filtered with a case-insensitive glob pattern.
$ fastmod ${regex} ${replacement} --dir ${path-to-directory} --iglob ${'**-*-{js,json}'}
try on your machine

This command is using the "fastmod" tool to make replacements in files within a specified directory.

Here is the breakdown of each element in the command:

  • fastmod: This is the executable command for the "fastmod" tool.
  • ${regex}: This is a placeholder for the regular expression pattern that you want to match within the files. Regular expressions are used to search for patterns in text.
  • ${replacement}: This is a placeholder for the replacement string that will replace any matches found by the regular expression pattern.
  • --dir ${path-to-directory}: This flag specifies the directory where the files are located. ${path-to-directory} is a placeholder for the actual path to the directory.
  • --iglob ${'**-*-{js,json}'}: This flag specifies the file glob pattern to match against the files in the directory. In this case, it is using the **-*-{js,json} pattern, which matches any file that has a dash in its name followed by either "js" or "json" as the file extension.

Overall, this command will search for files in the specified directory that match the given glob pattern, and for each file, it will perform replacements based on the provided regular expression and replacement string.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the fastmod tool