Sed command to replace a line in a file using line number from the output of a pipe.
Is it possible to replace a whole line piped from someother command into a file at paritcular line...
here is some basic execution flow..
the line number is 412
lineNo=412
Now i have a line coming as output from another command. for simplicity lets say i am
displaying contents of a file at particular line number
cat fileName.txt | sed -n ${lineNo}p | some sed replacement command goes here | "HERE SHOULD BE MY SED COMMAND which should replace the line 412 with the input got from previous command.
Is it feasible?
If not is there a way to output the command to a file(which obviously will have only one line) then take this as input and replace it at line 412 in the original fileName.txt file.