giovedì, settembre 10, 2009

String slicing in bash

Just a memo here:

${var_name:start_index:num_of_chars_after_index}

prompt:$ to_be_sliced="1234567890"

prompt:$ sliced=${to_be_sliced:5:${#to_be_sliced}}

prompt:$ echo $sliced
67890


Note:
${#var_name} returns the length of $var_name

Nessun commento: