Skip to content

Instantly share code, notes, and snippets.

@alsunseri
Created December 4, 2021 06:36
Show Gist options
  • Save alsunseri/55e9c3d4d98b90262888fa55bf447ac1 to your computer and use it in GitHub Desktop.
Save alsunseri/55e9c3d4d98b90262888fa55bf447ac1 to your computer and use it in GitHub Desktop.
grep for tabs
Several methods depending on the implementation of grep or whether the grep needs to be scripted etc.
1: If grep comes compiled with perl regex support use 'grep -P '
grep -P "\t" filelist
embedded in a pattern:
grep -P "^1.1G\t" /tmp/du-h-output.txt
2 this is neat - grep -G $'\t'
it works in larger patterns as well:
grep -G "^1.1G"$'\t' /tmp/du-h-output.txt
3 If you are on the command line and want to risk control-v:
in double quotes enter control-v once, let go and then hit the Tab key
i.e.
grep "<control-v><TAB>" filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment