hope you are doing fine
i want to get a substring of my string which has a format of : 18d6m2s and so.. all i'm interested in is getting only the number of days and if the string contains only minutes/seconds i want to get a value of null/zero ..
examples:
age=12d23m2s ... the needed output is 12
age=21m... the needed output is 0
age=22s... the needed output is 0
my solution was to use cut (i can't have a separate bash script and this would be the input for another command..)..
my solution:
awk -F "d" '{print $1}' $6
but this is only valid for strings with the d characters.. i want to set the strings which contains m/s only to zero/null..
how can i do that ?