Hello there,

>   I tried using cut to list permissions and filenames from a directory
>listing, example:
>
>   ls -l | cut -d"\b" -f 1,9 > temp.txt
>
>but the delimiter is more than a single character. Using -d " " for 
>the delimiter does not work as there are more than a single space 
>separating fields, and the white space is not uniformly a tab.

It can be tricky to get a universally workable sed, awk, uniq when 
trying to process the out put of 'ls', especially when it 
comes to filenames, which can have spaces themselves.

Are you comfortable with octal permissions?  If so, then the 'find' 
command affords a great deal of control and power:

  find . -mindepth 1 -maxdepth 1 -printf '%#m %p\n'

Here are four lines of output from one of my scratch directories:

  0644 ./150407-Plummer-Project-Update-Admin-Forum.pdf
  0644 ./1926 Grandmother 5 year diary.docx
  0755 ./Rtree-0.8.2
  0644 ./jvc-sp-50M-C.pdf

There's quite a bit that 'find' can do....

-Martin

-- 
Martin A. Brown
http://linux-ip.net/
_______________________________________________
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to