01-12-2009
Lines Concatenated with awk
Hello,
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.
Any ideas?
10 More Discussions You Might Find Interesting
1. Solaris
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)
Discussion started by: calmgreen
0 Replies
2. Shell Programming and Scripting
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)
Discussion started by: gimley
14 Replies
3. UNIX for Dummies Questions & Answers
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)
Discussion started by: pawannoel
122 Replies
4. Solaris
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)
Discussion started by: sb200
3 Replies
5. Shell Programming and Scripting
How would I go about storing a list of files in a sub-directory into a variable for argument passing? (2 Replies)
Discussion started by: ChazZeromus
2 Replies
6. Shell Programming and Scripting
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)
Discussion started by: kaaliakahn
3 Replies
7. Shell Programming and Scripting
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)
Discussion started by: Ophiuchus
2 Replies
8. Shell Programming and Scripting
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)
Discussion started by: aravindj80
24 Replies
9. UNIX for Dummies Questions & Answers
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)
Discussion started by: High-T
1 Replies
10. Shell Programming and Scripting
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)
Discussion started by: RalphNY
9 Replies