Hya,
Situation:
Code:
>cat tux
L
I
N
U
X
>cat tux | sed -e '2s/./<&>/'
L
<I>
N
U
X
Goal: The address for sed s command, (this case 2), need to be supplied by shell variable, like the code below.
Incorrect shellscript
Code:
#!/usr/bin/tcsh
sed -i -e "{$1}s/./<&>/" tux
I think this should work, but not. Then, after several try-and-errors I found that
Code:
sed -e $1's/./<&>/'
works, but it looks ugly.
I am somewhat confident that there is a neater way.
Question: Does anybody know the answer?
cheers