linux - file and path listing separator : -
this question has answer here:
- replacing characters in string character 5 answers
i need to list out folder structure folder/cd/dvd, need path , filename displayed. can using find command:
find /path*
but instead of usual / separator need separator :
so when use find on folder following output:
2d/resource/2011 brand-guidelines/1664/logos/1664/small/k1664-cmyk-background-small.ai 2d/resource/2011 brand-guidelines/1664/logos/1664/small/k1664-pms-background-simple-small.ai 2d/resource/2011 brand-guidelines/1664/logos/1664/small/k1664-pms-background-small.ai 2d/resource/2011 brand-guidelines/1664/logos/1664/small/k1664-pms-simple-small.ai
but need display output so:
2d:resource:2011 brand-guidelines:1664:logos:1664:small:k1664-cmyk-background-small.ai 2d:resource:2011 brand-guidelines:1664:logos:1664:small:k1664-pms-background-simple-small.ai 2d:resource:2011 brand-guidelines:1664:logos:1664:small:k1664-pms-background-small.ai 2d:resource:2011 brand-guidelines:1664:logos:1664:small:k1664-pms-simple-small.ai
this because users use slash's in file names when not supposed to.
here suggestion:
find /path* | sed 's/\//:/g'
or
find /path* | tr '/' ':'
both of them can meet requirement.
Comments
Post a Comment