Welcome to LQ. You'll notice a "Rule" is: post what you have
tried.
I add: web-research (&post your keywords); gets lots of info
instantly=
faster
One very valuable technique that's often overlooked is: break it into
simple pieces!!!
Here, start with i=17 then a single simple sed 32 print ...
to get the sed part working.
Separately, write a bash for loop, that just echo each $i
Then, put them together. Use
CODE tags to post what you try, and results.
Best wishes!!! Let us know... (
interview? homework? What class?)
More: here's
my web-search keywords (
1st result
might be sed solution!!!)
How to replace the n-th line in a file with a new line in Unix?
&1more:
I had glitch on passing $i in single-quotes, and d then i on
last line, so:
Code:
i=17;echo old | sed -e '1a'{$i}'' -e 1d #hints: "32a$i $i 1" #n=32; ... ${n}d
i=17;n=2;seq 3| awk "NR==$n {print $i,$i,1}; NR!=$n" #beats sed imho