Bash substrings
Say you have lines in a file that are of the format:
123:200105
and you need to split out the strings to work with them.
string=123:201004
string2=${string:0:3} # result is 123
string3=${string:4:6} # result is 201004
123:200105
and you need to split out the strings to work with them.
string=123:201004
string2=${string:0:3} # result is 123
string3=${string:4:6} # result is 201004
Comments
Post a Comment