If file is:
this is line onethis is line twothis is line three
I want to do something like:
awk -i inplace -v line_number=$line_number 'NR == line_number {print $1}' file
Lets say line_number=1
. Then desired result is:
thisthis is line twothis is line three
But instead, the file is being completely replaced by the edited version of line 1, resulting in:
this
What is the proper way to achieve the desired result?