The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 06-23-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,926
With grep you can match control characters like this:


Code:
grep '[[:cntrl:]]'

And non printable characters like this:


Code:
grep '[^[:print:]]'

Another workaround with shells expanding the special construct $'\X' (ksh93, bash, zsh):


Code:
zsh-4.3.4% printf "Hello\tWorld"|grep -l $'\t'
(standard input)
zsh-4.3.4% printf "Hello\tWorld"|grep -l $'\x09'
(standard input)