Thursday, October 6, 2022

[SOLVED] Use sed to write in Line with Variables

Issue

I want to write the content of a variable in a specific line. I got following code

sed -i "$line i\ $1" text.txt

How can i transfer $1 without the space?


Solution

sed -i "$line i $1" text.txt

Just used the same code without the \ and it worked



Answered By - Gegnatz
Answer Checked By - Senaida (WPSolving Volunteer)