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

Help on Character Converter using AWK.

Status
Not open for further replies.

boardy

Programmer
Jul 11, 2002
2
GB
Previously i used vba to change characters in a table.

example:

'Start the converter
Dim c As New ADODB.Recordset
Set db = DBEngine(0)(0)

ReDim chararray(256) As Integer

For x = 1 To 256
chararray(x) = 0
Next x

chararray(161) = 165
chararray(165) = 188
chararray(169) = 138
chararray(171) = 141
chararray(177) = 185
chararray(181) = 190
chararray(183) = 162
chararray(185) = 154
chararray(187) = 157
chararray(162) = 161
chararray(166) = 140
chararray(172) = 143
chararray(174) = 142
chararray(182) = 156
chararray(188) = 159
chararray(190) = 158

c.Open "tbl_char_converter", CurrentProject.Connection, adOpenDynamic, adLockOptimistic

lcount = 0

Do Until c.EOF
lcount = lcount + 1
lcountscr = lcount
[Forms]![Frm_int_afp_selection].Repaint
flen = Len(c![Line])
For x = 1 To flen
changechar = 0
If chararray(Asc(Mid(c![Line], x, 1))) > 0 Then

c![Line] = Mid(c![Line], 1, x - 1) & Chr(chararray(Asc(Mid(c![Line], x, 1)))) & Mid(c![Line], x + 1, flen)
c.Update
End If
Next x
c.MoveNext
Loop

Now instead of using vba and a table, i have a copy of the data in a table held in the database. I would like to be able to carry out the same function using AWK in UNIX.

Is this possible ??

Please help.

 
ARGHHH..visual basic, sputter, cough.. ;)

Could you just give us a sample? A before
and after example of the data is good.
 
Exactly! An example of your data and the output. Awk can do your character replacement without problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top