Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 10th November 2006, 02:11
violentbourbonmonkey violentbourbonmonkey is offline
Junior Member
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default newbie please help, i suck!!!

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 Any help would be appreciated, thanks.
Reply With Quote
Sponsored Links
  #2  
Old 11th November 2006, 02:59
violentbourbonmonkey violentbourbonmonkey is offline
Junior Member
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default 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
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am A newbie I need Help^__^ Unknown_X Installation/Configuration 30 2nd August 2006 10:12
Newbie starter guide on making site online kapatid General 10 9th May 2006 00:12
Help! Real newbie having problems installing Linux t-kiss Kernel Questions 5 4th April 2006 15:14
newbie DNS questions Kankles HOWTO-Related Questions 6 20th January 2006 03:50
General ISPConfig Newbie Questions christopher Installation/Configuration 1 24th November 2005 09:54


All times are GMT +2. The time now is 22:42.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.