I want to get a path to a file location given a full path to that file in bash:
path="/home/user123/Documents/folder1/file1.txt
Given that full path I want to extract the "/home/user123/Documents/folder1" part. Should I just parse the path and throw away the part after the latest "/" or is there a better way?