I tried opening files with vim using vim $(cat filelist) as suggested from this earlier question.
Suppose I have the following file:
~/Workspace/bar/foo.cpp
Executing vim $(cat filelist) from ~/Workspace correctly opens foo.cpp when filelist contains bar/foo.cpp. However, the command does not open the file when filelist contains ~/Workspace/bar/foo.cpp. I want to know why using the absolute path causes the command to fail.
~anywhere in their name, which is permitted. Add^in front of~in your regex matching of pattern space and drop the global flaggat the end of the substitution, unlessfilelistcontains more than one file record per line, although in this case a new issue would be how to distinguish two consecutive records andsedmight not be the best tool anymore. Also require the presence of/or be ready to deal with legit instances of~USER/in fqp of files. In the end I would dovim $(sed "s_^~/_${HOME}/_" filelist). – Cbhihe Jun 05 '21 at 06:24