I'm kinda new to shell scripts and I'm struggling to get only the information I need from a command.
I'm executing this script:
#!/bin/bash
myfunction(){
find . -name '*' -exec file {} \; | grep "image"
}
myfunction
Basically, what I need is the list of the names of the images on my directory and the data about their resolution, but I get a lot of data that are useless to me:
./image222s.jpeg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 554x554, components 3
./fruta-png.png: PNG image data, 1400 x 1501, 8-bit/color RGBA, non-interlaced
./ddd.jpeg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 540x568, components 3
./images.jpeg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 452x678, components 3
I'd like to know how can I reduce the output to only the file name and its resolution. Something like:
image.jpeg: 452x678
image222.jpeg: 554x554
Thanks!
-name '*'
is redundant - however you might want to add a-type f