hello.
I want to use variables in a script using a sed command line. How can I do ??
Imagine there's a file containing on each line a number ("2" on the first line of the file "file1". I want to stock the number on a given line. For example I want the number of the first line. I'd like to to something like that : sed -n '1,1p' file1 but with variables, like that :
in this case, i would be equal to 1
var1=$i,$i
var2="$var1"p
sed -n 'var2' file1
How can I do that ???
Thanx for helping me.
I want to use variables in a script using a sed command line. How can I do ??
Imagine there's a file containing on each line a number ("2" on the first line of the file "file1". I want to stock the number on a given line. For example I want the number of the first line. I'd like to to something like that : sed -n '1,1p' file1 but with variables, like that :
in this case, i would be equal to 1
var1=$i,$i
var2="$var1"p
sed -n 'var2' file1
How can I do that ???
Thanx for helping me.