Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
reading a hex number and freq

Posted by miguelrab (miguelrab), 28 November 2006
Hi,
  I need little help. can u please tel me how can I read  hex numbers between a range of number of digits e.g how can i read four to 30 digit hex numbers from large amount of given data by using tcl.
Cheers


Posted by admin (Graham Ellis), 28 November 2006
I'm not clear that I understand your specification exactly. Can you post up a sample of the data and desired result, and also the code you've tried so far?  Thanks

Posted by miguelrab (miguelrab), 28 November 2006
For Example if I have data
bjhkhihhhmnnoj kpi boot:0x08Ahiyiyin boot:0x897Abjjhjbjboot:0x124456A

Posted by miguelrab (miguelrab), 28 November 2006
for example if i have data
hgfsdhfghdgfrboot:0x122hjhkhknkboot:0x122Agugugu boot:0x89A676Biiu9iuou

output should be:

boot: 0x122A
boot:0x89A676B

so it looks at whole data which is string and takes out hex numbers from it which should are of minimum 4 digits and maximum 30 digits. It ignores all the other numbers.
cheers

Posted by admin (Graham Ellis), 28 November 2006
Ah .... with you now.   Have a look at the regexp command and that should do the trick for you.    Capture all matches to 0x followed by hex digits ...

Posted by miguelrab (miguelrab), 29 November 2006
Hi graham
But how can I define the range of digits using regexp it only handles fixed number of digits that i define.


Posted by admin (Graham Ellis), 29 November 2006
Use a count such as {4,30} if you want to match between 4 and 30 of the preceeding element.

Use [0-9a-fA-F] to specify "any hex digit".



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho