Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

- Find has some switches to sanityze the output

- Cal can be parsed (it's shows in the Unix Programming Environment, from 1983)

- Vi is a visual editor, it can be used as a front-end for ed/ex commands for I/O anyway. Kinda like the acme(1) of its day. You have both :w and :r. And, hint: it can input text from external pipes.

- Emacs is not Unix

- ls(1) is not meant to be parsed on files' content, that's the shell globbing for.



FWIW, POSIX specifies the ls output format for -l and several other flags. For example,

  If the -l option is specified, the following information
  shall be written for files other than character special and
  block special files:

  "%s %u %s %s %u %s %s\n", <file mode>, <number of links>,
    <owner name>, <group name>, <size>, <date and time>,
    <pathname>
There's no stat command in POSIX. More practically, the BSD and GNU versions of stat are completely incompatible. If you want to query a file's size or other metadata from a portable shell script, you need to parse the output of ls.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: