Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!nrl-cmf!cmcl2!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: comp.unix.wizards Subject: Re: Kernel Hacks & Weird Filenames Message-ID: <3267@phri.UUCP> Date: 11 May 88 22:40:07 GMT References: <13041@brl-adm.ARPA> <14020039@hpisod2.HP.COM> <326@augean.OZ> <7869@brl-smoke.ARPA> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 22 gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) writes: > Geez. Haven't you heard of "pipes and filters"? Pipe the output of "ls" > into a filter [...] In this case, it's a little bit complicated since the filter would have to be syntax-sensitive. Just doing "ls | cat -v" is no good because you want to escape \n in file names but not at the end of lines. You probably want to escape spaces in file names but no place else, etc. I'm sure it's possible to write some sort of sed command which takes: -rw-r--r-- 1 roy 491 Apr 27 14:01 calendar -rw-r--r-- 1 roy 817 May 11 13:15 foo bar and correctly figures out that the second file name is " foo bar" and only escapes those two spaces, but it would be ugly and difficult. Try and make that filter general enough to deal with the varient formats of "ls", "ls -l", "ls -ls", "ls -lsi", and "ls -lsig" and it sure starts to look like building control-character escapes into ls isn't such a bad idea after all. -- Roy Smith, System Administrator Public Health Research Institute 455 First Avenue, New York, NY 10016 {allegra,philabs,cmcl2,rutgers}!phri!roy -or- phri!roy@uunet.uu.net