I'm trying to capture the date/time portion of "ls -l" command as a file, but it puts a "blank line". How do I make it so that output file doesn't include a blank line?
Example 1 (saved as a variable works good):
var1=`ls -l /file1 | awk '{print $6,$7,$8}'`
echo $var1
May 24 23:06
Example 2 (blank line inserted):
ls -l /file1 | awk '{print $6,$7,$8}' > /tmp/out1
cat /tmp/out1
<blank line>
May 24 23:06
Any suggestion is appreciated.
Example 1 (saved as a variable works good):
var1=`ls -l /file1 | awk '{print $6,$7,$8}'`
echo $var1
May 24 23:06
Example 2 (blank line inserted):
ls -l /file1 | awk '{print $6,$7,$8}' > /tmp/out1
cat /tmp/out1
<blank line>
May 24 23:06
Any suggestion is appreciated.