Re: sed issue



Leslie Rhorer wrote:
Hello all,

I am far from being a Unix guru, so please forgive my ignorance in
advance. I am attempting to use sed to chop up a long line into several
smaller lines based on a reliably repeating pattern, but its is not working
because of an interfering issue. The file is being created by expect. The
expect script telnets to a device whose output is VT-100 (or something
similar), so it spits out lots of escape sequences. When I run sed against
the log file, it truncates the file after the first line, and I have been
unable to get it to read past the last character of the first line. In
fact, there are only two long lines, and the information I need is all in
the second line. I believe the problem is the first line is truncated with
0D, or to be more exact, the string with which sed seems to be having the problem is

...36 0D 00 1B 02 30...

Sed's output is truncated after the 36 and a newline inserted. This seems to be the only instance of the problematic string, but it is in every one of the expect log output files. How can I remove the offending characters so I can have sed go about the business of parsing the rest of the file for the strings in which I am interested?

To remove characters from a stream use (see man page for details)...

tr -d '\NNN'

where NNN is the octal representation of the character. You may specify more
than one character in the argument to option -d. You can also try to specify
a character class '[:cntrl:]' if in your case you suspect control characters
to be responsible for your problem.

Janis
.



Relevant Pages

  • Re: Soft-hyphens or breakable points in a string
    ... I specify a table width of 100%, but otherwise no cell dimensions are specified. ... An E-mail address is basically an unbreakable string that must not contain whitespace. ... URL or E-mail address needs to be broken, the break should appear "between elements, after a colon, a slash, a double slash, or the symbol @ but before a period or any other punctuation or symbols". ... If you enter a soft hyphen character, MS Word treats it as yet another graphic character and displayes it in all occasions. ...
    (comp.infosystems.www.authoring.html)
  • Re: sed issue
    ... the log file, it truncates the file after the first line, and I have been ... unable to get it to read past the last character of the first line. ... 0D, or to be more exact, the string with which sed seems to be having ... To get rid of control chars leaving only tabs and newlines, ...
    (comp.unix.shell)
  • sed issue
    ... the log file, it truncates the file after the first line, and I have been ... unable to get it to read past the last character of the first line. ... 0D, or to be more exact, the string with which sed seems to be having the ... one of the expect log output files. ...
    (comp.unix.shell)
  • Re: Why is it neccesary to include SqlDbType to the SqlParameter?
    ... I you try and insert a string longer than the field length without ... It does NOT throw the exception when you do specify the field length in the ... parameter, it simpy truncates. ... > AFAIK it is valid to not specify a size for varchar when using ...
    (microsoft.public.dotnet.general)
  • Re: OT - GETSYI (was:Re: PHONE error - Invalid specification of node or person. Try again.)
    ... Because this name can include up to 15 characters, the buffer length field in the item descriptor should specify 15. ... access: read only mechanism: by 32- or 64-bit descriptor-fixed-length string descriptor mechanism: by 32-bit descriptor-fixed-length string descriptor Name of the node about which $GETSYI is to return information. ... The nodename argument is the 32-bit address or the 32- or 64-bit address of a character string descriptor pointing to this name string. ...
    (comp.os.vms)