1

I have numbers with different digits each into variables, and I would like to write a script which split them into three variables each one using expect tcl. The first variable should contains three digits, the second always 8 digits, and the third one the remaining digits. How could I achieve that?

Ps: The available answers on the platform show how to achieve this with bash.

Numbers:

  1. 345653987652
  2. 87645625398784
  3. 3984737645
  4. 4657636359487564
Habineza
  • 13
  • 5
  • Have a look at the 2nd answer of the dup – Aserre May 31 '18 at 12:10
  • I don't see any resemblance with that question for the following reasons: first, it has underscore as a delimiter one can use to split, mine I have precised I don't have any delimiter in my numbers as I have clearly gave some examples. Secondly the second answer you are suggesting, they supposed that x was constant my numbers are not not. I don't get it. – Habineza May 31 '18 at 13:48
  • Yes it is constant. You want to extract the first 3 characters (constant), then the 8 next (constant), then the rest (constant : start index is 8+3, until the end of the string) – Aserre May 31 '18 at 14:00
  • @ Aserre, thank you so much, It 's now working as expected. – Habineza May 31 '18 at 14:30

0 Answers0