Bash; awk or sed output to variable: how keep newline at end of each output line
Either of
Code:
txt=$(sed -n -e "${ln[0]},${ln[1]} p" -e "${ln[1]} q" Notes) |
Have you tried to embed the variable in double quotes?
Code:
echo "$txt" |
Quote:
|
This is the way echo works: it outputs the arguments separated by spaces. Multiple lines are multiple arguments separated by newlines, whereas using double quotes multiple lines are treated as a single argument containing newlines and it is printed as is.
|
All times are GMT -5. The time now is 11:01 PM. |