0

This question already has an answer here:

I am running into a bit of an issue / quirk here:

[root@s06p5bcsmta001 elves]# TEST=$(cat -e sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# cat sendlog | wc -l
1050
[root@s06p5bcsmta001 elves]# TEST=$(cat sendlog)
[root@s06p5bcsmta001 elves]# echo $TEST | wc -l
1
[root@s06p5bcsmta001 elves]# echo -e $TEST | wc -l
1

How do I get the contents of the text file (with \n) into the variable?

marked as duplicate by Jeff Schaller, Anthony Geoghegan, George Vasiliou, Archemar, Kusalananda Feb 6 at 15:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    try echo "$TEST" | wc -l – Bodo Feb 6 at 14:33
0

Yep - it was quoting...

echo "$TEST" | wc -l
1050

TY, Bodo!!

Not the answer you're looking for? Browse other questions tagged or ask your own question.