Remove ending text

Hello,

I am working with a list that contains a large number of files listed by their absolute path. I am trying to determine a way to delete the file name at the end of each line, therefore leaving just the directory path. For example, I'd like to go from:

/home/something/file
/etc/whatever/thing/stuff
/var/log/messages

to

/home/something/
/etc/whatever/thing/
/var/log/

I remember that there is a simply command that accomplishes this, but I can't remember what it is for the life of me. Thanks for any assistance that can be provided.

-Omni

just use dirname

 
dirname /home/something/file

dirname is the command I was thinking of! However, it doesn't seem to be working properly when compared against a list of files. I tried throwing it in with the below while command, but it's just returning a leading period for each line.

while IFS= read line; do
        dirname "$line" > output
done < $1