|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
sed command question
Hi, everybody,
I tried to use a shell script to do a for loop: #!...bash for i in (5, 10, 15, 20) do; sed 's/bpp=64/bpp=$i/g' myfile.c > myfile2.c ~~ done However, each time it executes, "bpp=64" becomes "bpp=$i" instead of "bpp=5" ...... I have no idea how to make the $i inside sed command to be a real variable. Anybody has a suggestion for it? Thanks a lot! |
|
#2
|
|||
|
|||
|
hi,
for variables double quote, for wyswyg characters single quote. Concatenate when both are present: Code:
#if there were regular ocurrences of $ you could concatenate: sed 's/bpp=64/bpp='"$i/g" myfile.c > myfile2.c #if you only use $ for variables, just double quote: sed "s/bpp=64/bpp=$i/g" myfile.c > myfile2.c -Steven __________________ They do say, Mrs. M., that verbal insults hurt more than physical pain. They are of course wrong, as you will soon discover when I stick this toasting fork in your head. –Edmund Black Adder |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > sed command question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|