3

I want to detect the presence of ASCII control characters in my text file , excluding the control characters CR and LF

i am trying

grepl("[\x01-\x09\x11-\x12\x14-\x1F\x7F]",file$text)

where a sample file text looks like

enter image description here

but when i run the above grepl , i get the result as TRUE whereas i should be getting a False.

Sample text (open in notepad+)

Basically i want to detect the presence of ASCII SYMBOLS , except for CR and LF enter image description here

shashankp
  • 63
  • 1
  • 7
  • can you maybe add `dput(file$text)` to your question or the code to create `file`? – RolandASc Feb 09 '18 at 17:15
  • I am not able to provide you the exact text as the ascii control characters are removed when i try to paste the data here. Basically it should look like the data in the screenshot CAN SYN etc are control ascii characters and I would like to detect the presence of these control characters in the file – shashankp Feb 09 '18 at 18:37
  • `grepl("[\x01-\x09\x11-\x12\x14-\x1F\x7F]",file$text)` on these lines gives `FALSE` for all lines but the one that contains the control chars. It seems to work as expected. – Wiktor Stribiżew Oct 31 '18 at 08:52

0 Answers0