Toby Chamberlain wrote: > The ls in Etch has only one space after the drwx field, whereas Sarge has 2: > > eg: > touch /temp.txt > ls -l /temp.txt > > Sarge output: -rw-r--r-- 1 root root 0 2007-02-08 10:34 /temp.txt > Etch output: -rw-r--r-- 1 root root 0 2007-02-08 10:35 /temp.txt
The GNU Coreutils NEWS file lists this as a change in release 5.90 2005-09-29: ls no longer outputs an extra space between the mode and the link count when none of the listed files has an ACL. This was introduced by this change: 2005-06-10 Paul Eggert <[EMAIL PROTECTED]> Act on the Austin Group's response yesterday to XCU ERN 63; see <http://www.opengroup.org/austin/docs/austin_260.txt>. * NEWS: ls no longer outputs an extra space between mode and link count. * doc/coreutils.texi: Remove the extra spaces in "ls -l" output. * src/ls.c (any_has_acl): New var. (clear_files): Clear it. (gobble_file): Set it if a file has an ACL. (print_long_format): Omit needless space unless some file has an ACL. A pointer to the mail archive where this was announced is here: http://lists.gnu.org/archive/html/bug-coreutils/2005-06/msg00086.html > I have a number of scripts that use ls -l |cut -d' ' -f7 to get the date.. > all of these are broken after upgrading to etch (it needs -f6) I don't think counting on the number of spaces has ever been portable. For example the date format is different depending upon which locale is active at output time. And the legacy date format varies depending upon how old the time being displayed happens to be printing either the time of day or the year. Therefore even in Sarge with the 5.2.1 coreutils this might yield different results. In particular using the time field would contain two spaces when printing with single digit dates versus one when printing two digit dates. This really makes using cut -f' ' unsuitable as a general process. LC_ALL=C ls -ld drwxrwxrwt 3 root root 304 Feb 8 09:17 . LC_ALL=C ls -ld | cut -d' ' -f7 Feb echo 'drwxrwxrwt 3 root root 304 Feb 8 09:17 .' | cut -d' ' -f9 8 echo 'drwxrwxrwt 3 root root 304 Feb 18 09:17 .' | cut -d' ' -f9 09:17 LC_ALL=en_US.UTF-8 ls -ld drwxrwxrwt 3 root root 304 2007-02-08 09:17 . LC_ALL=en_US.UTF-8 ls -ld | cut -d' ' -f7 2007-02-08 LC_ALL=en_US.UTF-8 ls -ld | cut -d' ' -f9 . Using cut -f' ' is very problematic in these cases and I don't recommend it. Depending upon your goal using either awk to split on whitespace or using stat to extract the actual information may be more appropriate. stat --format='%y' . 2007-02-08 09:16:58.164657964 -0700 TZ=UTC stat --format='%y' . 2007-02-08 16:17:43.165985027 +0000 LC_ALL=C ls -ld drwxrwxrwt 3 root root 304 Feb 8 09:17 . echo 'drwxrwxrwt 3 root root 304 Feb 8 09:17 .' | awk '{print$6}' Feb echo 'drwxrwxrwt 3 root root 304 Feb 8 09:17 .' | awk '{print$6}' Feb When trying to split upon whitespace I recommend awk as being the better tool for the job. Bob -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]