The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-10-2009
amio amio is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 24
Question To remove the newline character while appending into a file

Hi All,

We append the output of a file's size in a file. But a newline character is appended after the variable.
Pls help how to clear this.

filesize=`ls -l test.txt | awk `{print $5}'`
echo File size of test.txt is $filesize bytes >> logfile.txt

The output we got is,
File size of test.txt is 1024
bytes.

Expected output:
File size of test.txt is 1024 bytes

Thanks,
Amio