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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search and replace <8d><8d> 1

Status
Not open for further replies.

abovebrd

IS-IT--Management
May 9, 2000
690
US
I have an input file called parcel that has fixed length lines of 810 charters long. I have a created the following script to delimit each line into comma delimted fixed legnth fields. It seems to be working fine until line 129048, at which point there appears to be an unexpected formting charters set. Vi shows the charter set as <8d><8d>, while text pad shows it as two squares. I am at a loose as to what this represents and as such how I would search and replace it ?

cat parcel| gawk --re-interval 'BEGIN{ FIELDWIDTHS="9 3 3 40 40 40 60 60 60 20 2 9 4 8 8 3 3 32 4 8 20 2 220 12 12 12 12 12 12 4 12 12 12 8 11 8 12"; } RT { $0 = RT; print $1,","$2,","$3,","$4,","$5,","$6,","$7,","$8,","$9,","$10,","$11,","$12,","$13,","$14,","$15,","$16,","$17,","$18,","$19,","$20,","$21,","$22,","$23,","$24,","$25,","$26,","$27,","$28,","$29,","$30,","$31,","$32,","$33,","$34,","$35,","$36,","$37; }'> tempfile4

 
It depends what code page or character set you are using. In DOS codepage 850 it was ì. In Windows-1252 it is undefined, and in ISO-8859-1 it is a reverse line feed.

In any case you should be able to replace it with a friendlier character using gsub("\x8d","?") or similar.

Annihilannic.
 
Many thanks Annihilannic,

Your regex example worked perfectly. ("\x8d","?")

cheers

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top