Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignore Binary

Status
Not open for further replies.

beaster

Technical User
Aug 20, 2001
225
0
0
US
The unix scripting forum gave me some script to perform what I needed, but I am stuck with an issue:

#begin code

BEGIN {
RS=FS=""
}
$1 ~ /^CB +/ && $2 ~ /^YES +/ { print prev }
{prev=$NF}

#end code

At the top of my file there is similiar to text below:

USERCODE:beaster

PASSWORD:

WO VABSC023G000205Y2900C00 NVT-560 TIME 060105 1347 PAGE 1

<rlsbp:cell=all;

Is there a way to have awk/nawk ignore what it perceives as binary?

Other post:
 
If you make this the first action in your script, it should work. Seems to work with GNU awk at least.
Code:
{ sub(/\x03/,"",$0) }

--
 
So like this below?

#begin code

BEGIN { sub(/\x03/,"",$0) }
RS=FS=""
}
$1 ~ /^CB +/ && $2 ~ /^YES +/ { print prev }
{prev=$NF}

#end code
 
Code:
#begin code

BEGIN {
  RS=FS=""
}

{ sub(/\x03/,"",$0) }

$1 ~ /^CB +/ && $2 ~ /^YES +/ { print prev }

{prev=$NF}

#end code

--
 
You could also just put a few getlines in the BEGIN clause to skip over the first few lines.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top