newbie please help, i suck!!!

Discussion in 'Programming/Scripts' started by violentbourbonmonkey, Nov 10, 2006.

  1. hey this is my first post here and i am desperately looking for some help! Im trying to write a shell script for the first time and ive run into some issues.

    Im writing a script that takes two strings as parameters, im then using sed to do replacements of the first string over the second string for given files.

    eg sed "sl/$1/$2/g" "$file"

    so this works fine and replaces the whole string with the whole string, now i need to work char by char. So given inputs of $1=abcd $2=ABCD, i need sed to replace all instances of a with A, b with B, c with C etc. Ive tried a few things already, and the way i was attempting was calling sed -e for each char, this is obviously a horrid way of doing it :p

    Im not a programming noob by any stretch of the word but this is giving me real issues :mad: Any help would be appreciated, thanks.
     
  2. solved

    hey, problem solved

    to do replace by char using sed you just need to specify the y option

    eg sed y/$var/$var/

    QED
     

Share This Page