Append to exisiting file on same line.

File Format

ABC|ABC|ABC|

need to add another text after last | which would a unix command output.

---------- Post updated at 02:05 PM ---------- Previous update was at 01:45 PM ----------

wc -l file| awk '{print $1}' | sed 's/$//' >> existingfile
It still adds to new line

Should be:

awk '{print $0 "another text"}' file > newfile

Need to get the output of "another text" from wc -l how do i incorporate that ?

Something like:

awk -v text=$(wc -l < file) '{print $0 text}' file > newfile

Says
Illegal variable name.