I am trying to list all the directories inside another directory and put it onto a file using sed.
Command Used:
ls -ld <directory path>/* | sed 's/^.*\(what.*\).*\//\1/' What it print onto terminal:
what_111 what_222 When I put it onto a file, this is what I see: Un-visible characters getting put onto file.
what_111^[[0m^[[K what_222^[[0m^[[K How do I remove them from sed output while putting onto file ? Any comments would be helpful.
lsand then remove colors? Just do not use ls.... You are asking XY question.on the text fileNo, onlsoutput. Does the filename itself contains unprintable characters or doeslsoutput them?When I put it onto a fileHow do you "put it onto a file"?Un-visible characters getting put onto file.How do you inspect the file content?