[SATLUG] Help with FIND & AWK commands

Enrique Sanchez esanchezvela.satlug at gmail.com
Tue May 14 14:26:37 CDT 2013


It sure looks like homework, too bad

it is finding files inside hidden directories, not hidden files.

you could use the "cut" command but then you would need to replace multiple
occurrence of white space for a single one

find /mnt/RAID-S/ -type f -not -name ".*" -exec ls -ld
--time-style=long-iso {} \; sed -e 's[\t ][\t ]*/ /g' | cut -d' ' -f 8-


here I used \t but I think you need to use the <ctrl-v><tab> sequence
 instead, that is what I used during my tests.


On Thu, May 9, 2013 at 7:45 AM, Craig <sargonemail at gmail.com> wrote:

> > In [SATLUG] Help with FIND & AWK commands John-Eric on Tue May 7 00:20:42
> > CDT 2013 wrote:
>  Giving pseudo-code, as this looks like a potential student class
>  assignment.
>
>  ...
> > Using grep allows me to search for files using the modified date, time,
> > size, name, or some combination.
> > Issues:
> > #1 I'm not interested in any hidden files but they are still included in
> > the find results.
> >     The two .mediaartlocal files should not be included.
> >     I thought (find . -type f -not -name ".*" ) would exclude hidden
> > files
>  in awk, break the print into two parts, in one part check for name
> starting
>  with the dot; in the other part do the standard print stuff.
>
> > #2 Is there a better way to print from the 8th token to the end of the
> > line?
> >     Some classical music files can have very long names.
> > "$8-" works for most languages I've used, but evidently, not for bash.
>  ...
>  Substitue awk number of fields for "end of line" and apply appropriate
>  programming construct(s) as needed to print from $8 to NF.
>
>  Craig
> --
> _______________________________________________
> SATLUG mailing list
> SATLUG at satlug.org
> http://alamo.satlug.org/mailman/listinfo/satlug to manage/unsubscribe
> Powered by Rackspace (www.rackspace.com)
>



-- 
Enrique Sanchez Vela
------------------------------------------


More information about the SATLUG mailing list