Hi Oliver, John, List, thanks a lot, since I have no gawk installed (Oliver) and, as Jim said, there's more to one byte characters than LF (John), I have jumped onto Jim's solution, which works very well!
Freundliche Grüße / Best regards Christian Fieres Mainova AG Planung und Betrieb Infrastruktur (M3-ON2) Service Operation Center Solmsstraße 38 60623 Frankfurt Telefon / Phone (069) 2 13-2 36 17 Mobil / Mobile (0170) 5 60 15 63 Telefax / Facsimile (069) 2 13-9 62 36 17 E-Mail [email protected] Mainova Aktiengesellschaft - Solmsstraße 38 - D-60623 Frankfurt am Main Vorsitzende des Aufsichtsrates: Oberbürgermeisterin Dr. h. c. Petra Roth - Vorstand: Dr. Constantin H. Alsheimer (Vorsitzender), Lothar Herbst, Joachim Zientek Sitz der Aktiengesellschaft: Frankfurt am Main - Amtsgericht Frankfurt HRB 7173 - USt-ID-Nr. DE 114184034 Müssen Sie diese E-Mail wirklich ausdrucken? - fragt der Mainova Energiecoach. Mehr Tipps und Antworten zum Thema Energieeffizienz unter http://www.mainova-energiecoach.de Oliver Pätzold <[email protected]> 15.09.2009 17:30 Bitte antworten an Oliver Pätzold <[email protected]> An "spectrum" <[email protected]> Kopie Christian Fieres <[email protected]> Thema Re: [spectrum] Semi-solution: Octet string conversion Hi Christian, here is a small bash funtion to convert hex -> ascii, not fine, but it works since years. hex2ascii(){ # # $1 - dot separates hexcode # for line in $(echo "$1"| gawk -F"." '{ for (i=1; i <= NF; i++) { print $i } }' ) do printf "\x$line" done printf "\n" } bash-3.00$ hex2ascii 21.A.21.20.4C.61.73.74.20.63. 6F.6E.66.69.67.75.72.61.74.69.6F.6E ! ! Last configuration bash-3.00$ King regards Oliver -- Oliver Pätzold Betrieb IP (T.SIN 14) DB Systel GmbH Kleyerstraße 27, 60326 Frankfurt am Main, E EG 01 Tel. 069 / 265-17397, Fax 069 / 265-36230, intern 955- Mobil: 0160 / 97408742 _________________________________________________________________________________ Das Reiseportal im Internet >> http://www.bahn.de Sitz der Gesellschaft: Frankfurt am Main Registergericht: Frankfurt am Main, HRB 78707 USt-IdNr.: DE252204770 Geschäftsführer: Detlef Exner (Vorsitzender), Norbert Becker, Dr. Burkhard Klanke, Dr. Klaus Rüffler Vorsitzender des Aufsichtsrates: Dr. Rolf Kranüchel 2009/9/15 Christian Fieres <[email protected]> Hi again, I've come across a quick and dirty solution: I have all ".A." expressions in my > 4000 character octet string sed-substituted by a "#" or anything, which allows for tr to replace this (single character) pattern with a newline "\n" before I run through a for loop to have each line converted to ascii using the script shown below. Nevertheless, if anyone knows an elegant solution to have an octet string like 21.A.21.20.4C.61.73.74.20.63.6F.6E.66.69.67.75.72.61.74.69.6F.6E.20.63.68.61.6E.67.65.20.61.74.20.31.30.3A.34.30.3A.32.30.20.44.65.75.74.73.63.68.20.54.75.65.20.53.65.70.20.31.35.20.32.30.30.39.20.62.79.20.66.30.37.39.61.64.6D.69.6E.A.21 converted to ! ! Last configuration change at 10:40:20 Deutsch Tue Sep 15 2009 by f079admin ! - let me know, I'm sure I am not the only one new to this kind of conversions. Maybe you are also interested to share your knowledge on the Wiki at dachsug.ch? Freundliche Grüße / Best regards Christian Fieres Mainova AG Planung und Betrieb Infrastruktur (M3-ON2) Service Operation Center Solmsstraße 38 60623 Frankfurt Telefon / Phone (069) 2 13-2 36 17 Mobil / Mobile (0170) 5 60 15 63 Telefax / Facsimile (069) 2 13-9 62 36 17 E-Mail [email protected] Mainova Aktiengesellschaft - Solmsstraße 38 - D-60623 Frankfurt am Main Vorsitzende des Aufsichtsrates: Oberbürgermeisterin Dr. h. c. Petra Roth - Vorstand: Dr. Constantin H. Alsheimer (Vorsitzender), Lothar Herbst, Joachim Zientek Sitz der Aktiengesellschaft: Frankfurt am Main - Amtsgericht Frankfurt HRB 7173 - USt-ID-Nr. DE 114184034 Müssen Sie diese E-Mail wirklich ausdrucken? - fragt der Mainova Energiecoach. Mehr Tipps und Antworten zum Thema Energieeffizienz unter http://www.mainova-energiecoach.de ----- Weitergeleitet von Christian Fieres/M3-ON/MAINOVA/DE am 15.09.2009 15:33 ----- Christian Fieres <[email protected]> 15.09.2009 15:16 Bitte antworten an Christian Fieres <[email protected]> An "spectrum" <[email protected]> Kopie Thema [spectrum] Octet string conversion Hi all, probably an easy one, but as a totally newbie to e.g. Perl or C, I do not really understand what the simple octetstring 2 ascii perl script someone gave me a few years ago that is intended to convert an octet string to an ascii text does: printf "%s\n",pack "H2" x scalar(split /\./, $ARGV[0]), split /\./, $ARGV[0]; What it does is clear - but not how it does it. So I am not able to convert such things as whole NCM configuration files given as an attribute's value in octet string format. (I'm on Solaris.) It contains ASCII #10 characters which are obviously ignored by the perl line above, so what I get is a one-line-string with concatenated lines. I'm sure the solution is clear, but I simply can't grab it. What I also did was try to replace all ".A." in my one line octet string by a newline, but didn't succeed with awk and sed, and my tr knowledge is rather non-existant, so a simple tr ".A." "\n" to have single lines to feed my perl script with doesn't do the job either. Whoever knows what I mean: please enlighten me! :) Thanks a lot. Freundliche Grüße / Best regards Christian Fieres Mainova AG Planung und Betrieb Infrastruktur (M3-ON2) Service Operation Center Solmsstraße 38 60623 Frankfurt Telefon / Phone (069) 2 13-2 36 17 Mobil / Mobile (0170) 5 60 15 63 Telefax / Facsimile (069) 2 13-9 62 36 17 E-Mail [email protected] Mainova Aktiengesellschaft - Solmsstraße 38 - D-60623 Frankfurt am Main Vorsitzende des Aufsichtsrates: Oberbürgermeisterin Dr. h. c. Petra Roth - Vorstand: Dr. Constantin H. Alsheimer (Vorsitzender), Lothar Herbst, Joachim Zientek Sitz der Aktiengesellschaft: Frankfurt am Main - Amtsgericht Frankfurt HRB 7173 - USt-ID-Nr. DE 114184034 Müssen Sie diese E-Mail wirklich ausdrucken? - fragt der Mainova Energiecoach. Mehr Tipps und Antworten zum Thema Energieeffizienz unter http://www.mainova-energiecoach.de --To unsubscribe from spectrum, send email to [email protected] with the body: unsubscribe spectrum [email protected] --To unsubscribe from spectrum, send email to [email protected] with the body: unsubscribe spectrum [email protected] --To unsubscribe from spectrum, send email to [email protected] with the body: unsubscribe spectrum [email protected] --- To unsubscribe from spectrum, send email to [email protected] with the body: unsubscribe spectrum [email protected]
