Robelle | Products | Library | Support | Partners | Contact Us

Finding 'Junk' in Data Fields

By Paul Gobes, Robelle Technical Support Manager

click for more info
A customer phoned who needed to isolate records where his operators had entered junk characters like carriage returns and line feeds.

If you know which column they are in, then Suprtool can find specific characters:

  >define  myfield,31,1
  >if      myfield = ^13        {ascii 13 = carriage return}

Otherwise you can use Qedit to find these records (if the fields in DATAFILE are not all ASCII, use Set Left and Set Right to isolate the ASCII portion):

  /set decimal on
  /list datafile '13           {'13 = carriage return }

But this customer didn't have Qedit (yet...) so we found the following Posix shell solution which finds any lines in the file called DATAFILE that have non-printable characters.

  :run sh.hpbin.sys;info="-L"
  shell/iX> grep "[[:cntrl:]]" DATAFILE

We took this approach because the expected regular expression for carriage returns: grep "\r" DATAFILE did not work.

Any ideas or other methods? Send your suggestions to Paul Gobes at Robelle.

Paul.Gobes@robelle.com
January 18, 2001