[SATLUG] Help with FIND & AWK commands

John-Eric johnericno at gmail.com
Tue May 7 00:20:42 CDT 2013


I'm having a couple of issues with the FIND & AWK commands:

find /mnt/RAID-S/ -type f -not -name ".*" -exec ls -ld 
--time-style=long-iso {} \; | awk '{print 
$6,$7,"x"$5,"\t",$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25}' 
 > /home/johneric/Scripts/filelist.txt



2010-03-02 01:19 x21162953 /mnt/RAID-S/Music/09-Carmignola-Vivaldi/01 - 
Concerto for Violin, Strings and Harpsichord in G minor, R. 331 -1. 
Allegro.flac
2010-03-02 01:12 x18953235 /mnt/RAID-S/Music/09-Carmignola-Vivaldi/02 - 
Concerto for Violin, Strings and Harpsichord in G minor, R. 331 -2. 
Largo.flac
2010-03-02 01:20 x21020437 /mnt/RAID-S/Music/09-Carmignola-Vivaldi/03 - 
Concerto for Violin, Strings and Harpsichord in G minor, R. 331 - 3. 
Allegro.flac
2010-03-02 01:21 x28067565 /mnt/RAID-S/Music/09-Carmignola-Vivaldi/04 - 
Concerto for Violin, Strings and Harpsichord in C, R. 190 - 1. Allegro.flac
2010-03-02 00:49 x17495896 /mnt/RAID-S/Music/09-Carmignola-Vivaldi/05 - 
Concerto for Violin, Strings and Harpsichord in C, R. 190 - 2. Largo.flac
2010-03-02 01:19 x22031697 /mnt/RAID-S/Music/09-Carmignola-Vivaldi/06 - 
Concerto for Violin, Strings and Harpsichord in C, R. 190 - 3. Allegro.flac
2010-03-02 01:20 x188523 
/mnt/RAID-S/Music/09-Carmignola-Vivaldi/.mediaartlocal/album-e80ee677c338882449b62a79aa83589b-69a7c69e62795da06a451f8747f020b2.jpeg 

2010-03-02 01:20 x188523 
/mnt/RAID-S/Music/09-Carmignola-Vivaldi/.mediaartlocal/album-f67729fe3b6d395926fb0ef395ed63e7-69a7c69e62795da06a451f8747f020b2.jpeg 


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.

#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.

John-Eric


More information about the SATLUG mailing list