Re: adding text to JPEGs, in bulk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tim wrote:
> 
> I think I can work out how to handle a batch of files to add consistent
> text, now.  But I haven't worked out how I could extract "256" from a
> filename like "img_0256.jpg", yet.  The filenames are all the same
> length, so there's got to be some tool that'll let me strip characters
> 7, 8 & 9 out of the name.
> 
Take a look at the cut command. As an example, look at:

echo 12345678 | cut -b3-5

The output will be 345. (bytes 3 through 5) If you did:

echo abcdefgh | cut -b4-8

you would get defg as your output.

Or in a script:

for i in *.jpg ; do
  number=$(echo $i | cut -b7-9)
  echo $number
done

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux