I have a filename in a format like:
system-source-yyyymmdd.dat
I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter.
You can use the cut command to get at each of the 3 'fields', e.g.:
$ echo "system-source-yyyymmdd.dat" | cut -d'-' -f2 source
"-d" specifies the delimiter, "-f" specifies the number of the field you require
2.1m questions
2.1m answers
60 comments
57.0k users