This is what I have to do:
Display the full file name (including the full path) and file size of all files whose name (excluding the path) is exactly 3 characters long.
This is the code I have:
find / -printf "Name: %f Path: %h Size: %s (bytes)\n" 2>/dev/null | grep -E "Name: .{3,} Path" | sed "s/Name: .* Path/Path/"
However, this gives me file names with at least 3 characters. I'm not sure how to specify exact file name length.
I'm using bash, if that helps/matters.
That didn't seem to work. I'm not sure how that would give me files with a file name exactly 3 characters long.
Sorry, I forgot one "?", it should find file names with 3 characters:
find / -name "???"
Regards
this will also print the files with exact three char long
ls|awk 'length($0)==3{print $0}'
joeyg
6
> find . -name "???" -print -exec ls -l {} \;
Now, this will give two output lines for each 'matching' entry.
Using awk or other tools can probably help you the rest of the way.
Thank you all very much! I think I got it figured out.