Michael Lazin on 16 Nov 2018 06:45:51 -0800


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

[PLUG] scripting help, variables in sed


My girlfriend has a large collection of scanned family photos many of which are different photos with the same name.  We eliminated all duplicates with fdupes, but she would like to put them all in one folder and give it to her sisters on a cd.

I had a bit of free time this morning and tried to write a for loop to accomplish this but I'm getting syntax errors and I'm kinda stuck.  Any help would be appreciated.  Here is my code so far:

  #!/bin/bash
var=1
for i in *.jpg; do sed -i -e "s/"($i)"/"($var++)""($i)/" ; done

I read that you need double quotes for variables to be parsed in sed but this is obviously tricky and I'm not an expert programmer.  Can anyone see what I'm doing wrong?

Thanks,

Michael

--
Michael Lazin

to gar auto estin noein te kai ennai
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug