请教:Variable in sed command# Unix - 噫吁兮,危乎高哉
r*s
1 楼
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!
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!