• The grep command finds patterns in strings.

  • It is usually used to extract lines from a file that contain a given word or phrase.

  • This is a very powerful tool when used together with pipes to filter outputs.

  • Example:
    Find the value of pixdim1 from the fslhd output
    fslhd im1 | grep pixdim1