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
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho