# the search-string, so this is loosely based on:
#Git grep file extension code#
# The rest of the code in this loop is here to move the last argument in While doĮrr=$(git grep - `git ls-files $moved | grep -iv "$EXCLUDES"` \ # arg-list to the list of files to search.Įrr="fatal: bad flag '-' used after filename" # If git-grep returns this "fatal." then move the last element of the # Store the stuff that is moved from the arguments. # Rebuild the list of fileendings to a good regexpĮXCLUDES=`echo $EXCLUDES | sed -e 's/ /\\|/g' -e 's/.*/\\.\\(\\)/'` # therefor I crafted the while-thing that moves path-parts to the other side # But there is issues with giving extra path information to the script # The basic setup of this script is from here: The result of this is the occurences of the pattern (by the line it is found) in the file (s). You can also use the wildcard () to select all files in a directory. Note that single or double quotes are required around the text if it is more than one word. If no folder name is given, grep command will search the string inside the current working directory. When -R options is used, The Linux grep command will search given string in the specified directory and subdirectories inside that directory.
# NOTE: The filetypes to exclude is hardcoded for my specific needs. The syntax is: grep '# Wrapper of git-grep that excludes certain filetypes.
conf Output a.conf b. if you want to print only the names of files containing the matched pattern, use the -l.