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

Comments

Popular posts from this blog

Database, schema, and table sizes in Greenplum

Greenplum update with multiple tables

Show running queries on Postgresql/Greenplum