I have a bash shell script and I use awk to print certain columns of one file and direct the output to another file. If I do a less or cat on the file it looks correct, but if I email the file and open it with Outlook the lines outputted by awk are concatenated.
Here is my awk line:
awk '{print $6" "$7" "$8" "$9" "$5}' /data/tmp/snapshots_report.deltas >> $EMAIL_BODY
I use a perl script to email it.
Here is how it looks with cat:
[root@rmhesx01 tmp]# cat snapshots_report.email
Adam1:
Jan 12 11:19 Adam1-000001-delta.vmdk 7.0K
Jan 12 11:19 Adam1-000002-delta.vmdk 7.0K
Jan 12 11:19 Adam1-000003-delta.vmdk 16M
Jan 12 11:19 Adam1_1-000001-delta.vmdk 10K
Jan 12 11:19 Adam1_1-000002-delta.vmdk 10K
Jan 12 11:19 Adam1_1-000003-delta.vmdk 10K
Centramax:
Jan 12 11:19 Centramax-000001-delta.vmdk 16M
Looks like this in my email client:
Adam1:
Jan 12 11:19 Adam1-000001-delta.vmdk 7.0K Jan 12 11:19 Adam1-000002-delta.vmdk 7.0K Jan 12 11:19 Adam1-000003-delta.vmdk 16M Jan 12 11:19 Adam1_1-000001-delta.vmdk 10K Jan 12 11:19 Adam1_1-000002-delta.vmdk 10K Jan 12 11:19 Adam1_1-000003-delta.vmdk 10K
Centramax:
Jan 12 11:19 Centramax-000001-delta.vmdk 16M
I know that linux uses LF for newline and windows uses CRLF, but I cant figure out if that is what is causing this issue. I have tried adding "\n" to my awk statement but then I get double-spacing which I dont want.
You might want to investigate dos2unix and unix2dos. These two commands help convert files to adjust for the differences in file structures.
I know that I use these frequently to handle CR (carriage return) and LF (line feed) issues.
# Loop through all VMs running on the host
for VM_CONFIG in `vmware-cmd -l`
do
# Get the VMs name
VM_NAME=`basename $VM_CONFIG | awk -F. '{print $1}'`
# Get the VMs directory
VM_DIR=`dirname $VM_CONFIG`
# Go into the directory and look for snapshot files
cd $VM_DIR
ls -lah *delta* > /dev/null 2>&1
if [ $? -eq 0 ]; then
ls -lah *delta* > /data/tmp/snapshots_report.deltas
echo $VM_NAME: >> $EMAIL_BODY
awk '{print $6" "$7" "$8" "$9" "$5"\n"}' /data/tmp/snapshots_report.deltas >> $EMAIL_BODY
# echo >> $EMAIL_BODY
FLAG=1
fi
done
if [ $FLAG -eq 0 ]; then
echo "No snapshots exist" > $EMAIL_BODY
fi
which will show the file as created. Very interested to see if there are '10' characters and/or '13' characters, which are line-feed and carriage-return.
Could that perl script that is emailing also be involved in this oddity? Have you tried mailx or mutt for email?
which will show the file as created. Very interested to see if there are '10' characters and/or '13' characters, which are line-feed and carriage-return.
Could that perl script that is emailing also be involved in this oddity? Have you tried mailx or mutt for email?
Well here is the output of the command you gave me:
Hello all,
I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person.
In the csv, a person may be listed from one to four times... (9 Replies)
URGENT HELP IS NEEDED!!
I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but
- Currently, script is not printing lines to File3.txt in order.
- Also the matching lines are not moving out of File1.txt
... (1 Reply)
file 1
Sun Mar 17 00:01:33 2013 submit , Name="1234"
Sun Mar 17 00:01:33 2013 submit , Name="1344"
Sun Mar 17 00:01:33 2013 submit , Name="1124"
..
..
..
..
Sun Mar 17 00:01:33 2013 submit , Name="8901"
file 2
Sun Mar 17 00:02:47 2013 1234 execute SUCCEEDED
Sun Mar 17... (24 Replies)
Hello everyone,
Maybe somebody could help me with an awk script.
I have this input (field separator is comma ","):
547894982,M|N|J,U|Q|P,98,101,0,1,1
234900027,M|N|J,U|Q|P,98,101,0,1,1
234900023,M|N|J,U|Q|P,98,54,3,1,1
234900028,M|H|J,S|Q|P,98,101,0,1,1
234900030,M|N|J,U|F|P,98,101,0,1,1... (2 Replies)
Hi friends,
This is sed & awk type question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example
###start of input text file ####
abc
def
ghi
1
2
3
4
kjld
random... (3 Replies)
Hi
I need to add new slice to existing concatenated volume. Please let me know the process to do the same
I have d0 concatenated volume which consist of c1t0d0s7 & c1t2d0s0
bash-3.00# df -h /export/home
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d0 ... (3 Replies)
Hi All,
Is there a way to get NON unique lines from 2 or more concatenated files?
Basically I have several files which are very similar with the exception of few lines and I want to find out which lines are different in each file. Very simple example is
file1 contains:
1
2
3
4
5file2... (122 Replies)
hello,
I had posted earlier help for a script for splitting concatenated words . The script was supposed to read words from a master file and split concatenated words in the slave/input file.
Thanks to the help I got, the following script which works very well was posted. It detects residues by... (14 Replies)
Hello,
If I boot up from install media in single user mode (Solaris 9 - if it matters), will I be able to mount a concatenated volume? I have combined several disks into one non-os filesystem and I want to be able to mount it while booted in single user mode from cdrom. i.e., mount... (0 Replies)