package main import ( "fmt" "strings" ) func main() { filePath := "/mnt/data/repo/dists/pimox/pimox_v6/binary-all/ceph-mgr-diskprediction-local_15.2.13-pve1_all.deb" splitPath := strings.Split(filePath, "/") archFull := splitPath[len(splitPath)-2] archSplit := strings.Split(archFull, "-") distro := splitPath[len(splitPath)-4] section := splitPath[len(splitPath)-3] fmt.Println(distro) fmt.Println(section) fmt.Println(archSplit[1]) }