Package: coreutils Version: 5.96-5 Severity: wishlist
Typical problem: suppose we want to parse 'ls -l' to get file sizes. The 'ls -l' file size field is right justified, separated by spaces, and its rightmost columnar position depends on the width of the user and group names. Example: # file size (0 in this case) for 'user.log' ends at # column 25. % ls -l /var/log/clamav/clamav.log /var/log/user.log -rw-r----- 1 clamav adm 0 Jul 16 07:44 /var/log/clamav/clamav.log -rw-r----- 1 root adm 0 Jul 21 08:09 /var/log/user.log # same file, but now it ends at column 23. % ls -l /var/log/user.log -rw-r----- 1 root adm 0 Jul 21 08:09 /var/log/user.log No option in 'cut' can handle that: 1) changing the field separator won't work, because the number of spaces in 'ls -l' can vary with file size. 2) fixed columnar positions won't work, because the columnar position in 'ls -l' varies with the width of the user and group names. It'd be easier if 'cut' had an option to handle white space like the shell's positional parameters. Here's how to cut the file size field using any Bourne compatible shell: # print the 5th field. cd foo; ls -l | while read x ; do set - $x ; echo $5 ; done So, it'd be nice there was a '-p' (for positional parameters) option for 'cut'. Suggested usage: cd foo; ls -l | cut -p -f 5 If '-p' is too unmemorable, perhaps '-w' for "whitespace". NB: 'ls -l' is just a familiar example -- of course there are other ways to get file sizes that work with the current version of 'cut'; e.g. using 'ls' with other options, or utils like 'wc'. The point is that there's always input data where there are no such options. Hope this helps... -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/dash Kernel: Linux 2.6.16-2-686 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Versions of packages coreutils depends on: ii libacl1 2.2.39-1 Access control list shared library ii libc6 2.3.6-15 GNU C Library: Shared libraries ii libselinux1 1.30-1 SELinux shared libraries coreutils recommends no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]