I am not sure if you meant to delete the last character of every line or the last character of the file. This should delete newline characters from the end of each line:
02:35:17 | cat dog
filename=$1
awk '{printf("%s ",$0)};END{print}' $filename
02:35:24 | cat testfile
alpha
beta
gamma
delta
02:35:35 | dog testfile
alpha beta gamma delta
02:35:43 |
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.