[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

bash: how to split a $var ?



In bash how can I split a string eg ...

var1=0624todaysfile

I want var2 to equal the first 4 digits, ie 0624
My first instinct was cut but this is for files only, head & tail are of no use ...

Many thanks
Dave



Reply to: