Bash: Strip trailing linebreak from output
If your expected output is a single line, you can simply remove all newline characters from the output. It would not be uncommon to pipe to the tr utility, or to Perl if preferred: wc -l < log.txt | tr -d ‘\n’ wc -l < log.txt | perl -pe ‘chomp’ You can also use command … Read more