Re: fields in files

2011-01-30 Thread Camaleón
On Sun, 30 Jan 2011 11:26:16 +, Lisi wrote:

 In teh following:
 -rw-r--r-- 1 lisi lisi19503 2011-01-28 21:12 Etch_repositories.odt
 
 I can see eight pieces of information: permissions, directory or file
 (information that is also at the beginning of the permissions), owner,
 group (or group, owner), size, date, name of file or directory.
 
 What are these called?  I have always called them fields, but it would
 appear that I am wrong to do so.

directory/file 
user perms-group perms-others perms
user-group
size
last modified timestamp
file name

I call them file attributes but not sure if that's the technical name 
though :-)

Greetings,

-- 
Camaleón


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/pan.2011.01.30.11.35...@gmail.com



Re: fields in files

2011-01-30 Thread Lisi
On Sunday 30 January 2011 11:35:56 Camaleón wrote:
 On Sun, 30 Jan 2011 11:26:16 +, Lisi wrote:
  In teh following:
  -rw-r--r-- 1 lisi lisi19503 2011-01-28 21:12 Etch_repositories.odt
 
  I can see eight pieces of information: permissions, directory or file
  (information that is also at the beginning of the permissions), owner,
  group (or group, owner), size, date, name of file or directory.
 
  What are these called?  I have always called them fields, but it would
  appear that I am wrong to do so.

 directory/file
 user perms-group perms-others perms
 user-group
 size
 last modified timestamp
 file name

 I call them file attributes but not sure if that's the technical name
 though :-)

Thanks, Camaleón!  Yes ,that it what they are in this context.  But in more 
general terms, like page, chapter, section etc., rather than the names of 
that particular page etc. -  what are they called?  I want to use it with cut 
if possible, but can't even find if there is a suitable option when I don't 
know what they are called.  Column is too narrow (in the physical sense) a 
definition.  There are 21 of what cut calls columns in the name of the file 
alone in this sample!

Lisi


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201101301218.39391.lisi.re...@gmail.com



Re: fields in files

2011-01-30 Thread Axel Freyn
Hi Lisi,
On Sun, Jan 30, 2011 at 12:18:39PM +, Lisi wrote:
 On Sunday 30 January 2011 11:35:56 Camaleón wrote:
  On Sun, 30 Jan 2011 11:26:16 +, Lisi wrote:
   In teh following:
   -rw-r--r-- 1 lisi lisi19503 2011-01-28 21:12 Etch_repositories.odt
  
   I can see eight pieces of information: permissions, directory or file
   (information that is also at the beginning of the permissions), owner,
   group (or group, owner), size, date, name of file or directory.
  
   What are these called?  I have always called them fields, but it would
   appear that I am wrong to do so.
 
  directory/file
  user perms-group perms-others perms
  user-group
  size
  last modified timestamp
  file name
 
  I call them file attributes but not sure if that's the technical name
  though :-)
 
 Thanks, Camaleón!  Yes ,that it what they are in this context.  But in more 
 general terms, like page, chapter, section etc., rather than the names of 
 that particular page etc. -  what are they called?  I want to use it with cut 
 if possible, but can't even find if there is a suitable option when I don't 
 know what they are called.  Column is too narrow (in the physical sense) a 
 definition.  There are 21 of what cut calls columns in the name of the file 
 alone in this sample!

Is that what you want to achieve?

ls -l | sed -e 's/  */ /g'  | cut -f 8 -d  

This gives the 8's element in the line, that is the filename.
I used sed to replace multiple spaces by a single one, and then cut
to select an appropriate element

Axel


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110130124532.GJ22032@axel



Re: fields in files

2011-01-30 Thread Camaleón
On Sun, 30 Jan 2011 12:18:39 +, Lisi wrote:

 On Sunday 30 January 2011 11:35:56 Camaleón wrote:

 I call them file attributes but not sure if that's the technical name
 though :-)
 
 Thanks, Camaleón!  Yes ,that it what they are in this context.  But in
 more general terms, like page, chapter, section etc., rather than the
 names of that particular page etc. -  what are they called?  I want to
 use it with cut if possible, but can't even find if there is a suitable
 option when I don't know what they are called.  Column is too narrow (in
 the physical sense) a definition.  There are 21 of what cut calls
 columns in the name of the file alone in this sample!

Ah!

In the cut context they are called fields as you said, yep. But 
better if you put and example of what do you want to get and why the 
name it is relevant to this case. Hum, oh... maybe something like this? 

sm01@stt008:~$ ls -l | awk '{print $9}'

Desktop
Documentos
file:
News
PDF

Greetings,

-- 
Camaleón


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/pan.2011.01.30.12.47...@gmail.com



Re: fields in files

2011-01-30 Thread Andrei Popescu
On Du, 30 ian 11, 12:47:43, Camaleón wrote:
 
 sm01@stt008:~$ ls -l | awk '{print $9}'
 
 Desktop
 Documentos
 file:
 News
 PDF

No need for awk, ls will do that with the -1 (the digit 1) option or by 
default if the output is not a terminal (ex. a pipe).

Regards,
Andrei
-- 
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic


signature.asc
Description: Digital signature


Re: fields in files - thanks! :-)

2011-01-30 Thread Lisi
Thanks so much all of you.  I am rushing to go out, but will get straight back 
on this when I get back and start using - or at least analysing - what you 
have so kindly given me.

Lisi


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201101301310.51446.lisi.re...@gmail.com



Re: fields in files

2011-01-30 Thread John Hasler
Lisi writes:
 Thanks, Camaleón!  Yes ,that it what they are in this context.  But in more 
 general terms, like page, chapter, section etc., rather than the names of 
 that particular page etc. -  what are they called?

The appropriate context is database.  They are fields.  The line is a
record.
-- 
John Hasler


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/874o8qv7kj@thumper.dhh.gt.org



Re: fields in files

2011-01-30 Thread Osamu Aoki
On Sun, Jan 30, 2011 at 02:53:14PM +0200, Andrei Popescu wrote:
 On Du, 30 ian 11, 12:47:43, Camaleón wrote:
  
  sm01@stt008:~$ ls -l | awk '{print $9}'
  
  Desktop
  Documentos
  file:
  News
  PDF
 
 No need for awk, ls will do that with the -1 (the digit 1) option or by 
 default if the output is not a terminal (ex. a pipe).

Also stat command is quite handy to get file attribute information
directly in a format you wish :-)


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110130152950.gb12...@debian.org



Re: fields in files

2011-01-30 Thread Camaleón
On Sun, 30 Jan 2011 14:53:14 +0200, Andrei Popescu wrote:

 On Du, 30 ian 11, 12:47:43, Camaleón wrote:
 
 sm01@stt008:~$ ls -l | awk '{print $9}'
 
 Desktop
 Documentos
 file:
 News
 PDF
 
 No need for awk, ls will do that with the -1 (the digit 1) option or by
 default if the output is not a terminal (ex. a pipe).

To get the filename, yes, but how about if you want to fetch a fancy file 
attributes combo output? :-)

sm01@stt008:~$ ls -l --full-time | awk '{print $6, $9}'
 
2011-01-30 Desktop
2010-05-16 Documentos
2009-11-14 file:
2009-12-27 News
2010-12-02 PDF

Greetings,

-- 
Camaleón


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/pan.2011.01.30.17.33...@gmail.com



Re: fields in files

2011-01-30 Thread Paul E Condon
On 20110130_134532, Axel Freyn wrote:
 Hi Lisi,
 On Sun, Jan 30, 2011 at 12:18:39PM +, Lisi wrote:
  On Sunday 30 January 2011 11:35:56 Camaleón wrote:
   On Sun, 30 Jan 2011 11:26:16 +, Lisi wrote:
In teh following:
-rw-r--r-- 1 lisi lisi19503 2011-01-28 21:12 Etch_repositories.odt
   
I can see eight pieces of information: permissions, directory or file
(information that is also at the beginning of the permissions), owner,
group (or group, owner), size, date, name of file or directory.
   
What are these called?  I have always called them fields, but it would
appear that I am wrong to do so.
  
   directory/file
   user perms-group perms-others perms
   user-group
   size
   last modified timestamp
   file name
  
   I call them file attributes but not sure if that's the technical name
   though :-)
  
  Thanks, Camaleón!  Yes ,that it what they are in this context.  But in more 
  general terms, like page, chapter, section etc., rather than the names of 
  that particular page etc. -  what are they called?  I want to use it with 
  cut 
  if possible, but can't even find if there is a suitable option when I don't 
  know what they are called.  Column is too narrow (in the physical sense) a 
  definition.  There are 21 of what cut calls columns in the name of the file 
  alone in this sample!
 
 Is that what you want to achieve?
 
 ls -l | sed -e 's/  */ /g'  | cut -f 8 -d  
This give the file name field.
An alternative is:
ls -l | tr -s ' ' | cut -f 8 -d ' '

But beware. If the file name contains embedded space(s), it will
give only the leading part up to the first space. To get the whole
file name, use:
ls -l | tr -s ' ' | cut -f 8- -d ' '

If you are interested in processing the date and time fields, be
aware that the detailed format that is used depends on how old 
the file is at the time of execution of 'ls'. I get around this
pandering to human traditions by defining shell variable

TIME_STYLE=+%Y%m%d_%H%M%S 

This combines date and time-of-day into a single field. A file 
of data about files using this, remains correct when reconstructed
at a later date. A full-up geek design decision with no concession
to human frailty would be to use

TIME_STYLE=+%s

This gives seconds since UNIX epoch. Which might be useful if you are
collecting data from computers that are operating in different time
zones.

hth
-- 
Paul E Condon   
pecon...@mesanetworks.net


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110130215903.gb19...@big.lan.gnu



Re: fields in files

2011-01-30 Thread Lisi
On Sunday 30 January 2011 21:59:03 Paul E Condon wrote:
 On 20110130_134532, Axel Freyn wrote:
  Hi Lisi,
 
  On Sun, Jan 30, 2011 at 12:18:39PM +, Lisi wrote:
   On Sunday 30 January 2011 11:35:56 Camaleón wrote:
On Sun, 30 Jan 2011 11:26:16 +, Lisi wrote:
 In teh following:
 -rw-r--r-- 1 lisi lisi19503 2011-01-28 21:12
 Etch_repositories.odt

 I can see eight pieces of information: permissions, directory or
 file (information that is also at the beginning of the
 permissions), owner, group (or group, owner), size, date, name of
 file or directory.

 What are these called?  I have always called them fields, but it
 would appear that I am wrong to do so.
   
directory/file
user perms-group perms-others perms
user-group
size
last modified timestamp
file name
   
I call them file attributes but not sure if that's the technical
name though :-)
  
   Thanks, Camaleón!  Yes ,that it what they are in this context.  But in
   more general terms, like page, chapter, section etc., rather than the
   names of that particular page etc. -  what are they called?  I want to
   use it with cut if possible, but can't even find if there is a suitable
   option when I don't know what they are called.  Column is too narrow
   (in the physical sense) a definition.  There are 21 of what cut calls
   columns in the name of the file alone in this sample!
 
  Is that what you want to achieve?
 
  ls -l | sed -e 's/  */ /g'  | cut -f 8 -d  

 This give the file name field.
 An alternative is:
 ls -l | tr -s ' ' | cut -f 8 -d ' '

 But beware. If the file name contains embedded space(s), it will
 give only the leading part up to the first space. To get the whole
 file name, use:
 ls -l | tr -s ' ' | cut -f 8- -d ' '

 If you are interested in processing the date and time fields, be
 aware that the detailed format that is used depends on how old
 the file is at the time of execution of 'ls'. I get around this
 pandering to human traditions by defining shell variable

 TIME_STYLE=+%Y%m%d_%H%M%S

 This combines date and time-of-day into a single field. A file
 of data about files using this, remains correct when reconstructed
 at a later date. A full-up geek design decision with no concession
 to human frailty would be to use

 TIME_STYLE=+%s

 This gives seconds since UNIX epoch. Which might be useful if you are
 collecting data from computers that are operating in different time
 zones.
 Thanks, Paul. :-)

Lisi



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201101302257.16910.lisi.re...@gmail.com