Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Merge Text with space into once cell and send email out Post 303041301 by lpoolfc on Wednesday 20th of November 2019 09:09:31 PM
Old 11-20-2019
Merge Text with space into once cell and send email out

Please help!!

This code works perfect but the only problem I am having is that is treats eg SQL Developer as separate cell/column which makes the formatting bad. I want to put SQL Developer in one cell. I attached a sample of how the output looks like.

report.txt
Code:
USERNAME             OSUSER       MACHINE              PROGRAM                                 COUNT(*)             
-------------------- ------------ -------------------- -------------------------                              ----------             
xxxxxxx                       xxxxxxx      xxxxxxx         	    Toad.exe                                       5             
xxxxxxx                       xxxxxxx      xxxxxxx                     SQL Developer                          4

Code:
awk ' BEGIN {
 print "From: from@x.com"
 print "To: to@x.com"
 print "MIME-Version: 1.0"
 print "Content-Type: text/html"
 print "Subject: Your Subject"
 print "<html><body><table border=1 cellspacing=2 cellpadding=3>"
 print "<tr>"
 print "</tr>"
} {
 print "<tr>"
 print "<td>"$1"</td>";
 print "<td>"$2"</td>";
 print "<td>"$3"</td>";
 print "<td>"$4"</td>";
 print "<td>"$5"</td>";
 print "</tr>"
} END {
 print "</table></body></html>"
} ' report.txt | sendmail -t

Merge Text with space into once cell and send email out-capturepng

Last edited by Scrutinizer; 11-26-2019 at 05:11 PM.. Reason: Additional code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

2. Shell Programming and Scripting

shell script to send email with usage of space in the directory as description :

shell script to send email with usage of space in the directory as description : Please any one help me in writing a script to send email with usage of space in the directory as description . (3 Replies)
Discussion started by: sakthifire
3 Replies

3. UNIX for Dummies Questions & Answers

File need to send to xls as one complete cell

Hi every one, I have a file of ten lines in unix i want to send the file to my mail as .xls and the clause over here is it should send in only one cell .. I am aware of uuencode rest rest.xls | mail -s "testing" mailid But this would send me data into seperate cells (5 Replies)
Discussion started by: rakesh_pagadala
5 Replies

4. Shell Programming and Scripting

Check space of directories and send email if it has reached threshold limit

Hi, I need help in writing unix script for checking space of some directories on the system and also send an email when it reaches the threshold limit. I have written the followng code; #!/bin/ksh ADMIN="me@somewhere.com" # set alert level 80% is default THRESHOLD=80 df | grep -E... (5 Replies)
Discussion started by: jmathew99
5 Replies

5. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

6. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

7. Shell Programming and Scripting

How to read specific line of text from a Script and send email notification

Hi ! I am a newbie and never officially wrote a shell script before. The requirement for this script is : 1) Read a file called 'bpm.log' and identify if it has a specific text such as 'this is the text'. Its a static value and that is the only text we need to read. 2) If that... (2 Replies)
Discussion started by: atechcorp
2 Replies

8. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

9. Shell Programming and Scripting

Read a file, add some text and send an email

Hi, If I am asking this question, you must have already figured out , that I am new to Unix, so here it goes I was trying to read a file, add some user defined content to it and send out an email , I did find out a way to achieve this, but looking at the code, it looks a bit crude to me, can... (3 Replies)
Discussion started by: karthikbhuvana
3 Replies

10. Shell Programming and Scripting

Send Disk Space Usage Status via email

Hi Guys, Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week? Thanks, (5 Replies)
Discussion started by: g4v1n
5 Replies
thai/thcell.h(3)						      libthai							  thai/thcell.h(3)

NAME
thai/thcell.h - Thai string cell custering. SYNOPSIS
Data Structures struct thcell_t Thai char cell representation. Functions void th_init_cell (struct thcell_t *cell) Initialize a Thai cell. size_t th_next_cell (const thchar_t *s, size_t len, struct thcell_t *cell, int is_decomp_am) Get first cell from string. size_t th_prev_cell (const thchar_t *s, size_t pos, struct thcell_t *cell, int is_decomp_am) Get previous cell from string. size_t th_make_cells (const thchar_t *s, size_t len, struct thcell_t cells[], size_t *ncells, int is_decomp_am) Tokenize string into cells. Detailed Description Thai string cell custering. Function Documentation void th_init_cell (struct thcell_t *cell) Initialize a Thai cell. Parameters: cell : pointer to the cell to initialize Initializes values in the Thai cell struct. size_t th_make_cells (const thchar_t *s, size_tlen, struct thcell_tcells[], size_t *ncells, intis_decomp_am) Tokenize string into cells. Parameters: s : the string len : the length of string cells : the array of output cells buffer ncells : the address of integer storing the number of cells provided by the buffer, and to keep the number of resulting cells on return is_decomp_am : whether SARA AM is to be decomposed into NIKHANIT and SARA AA and to be in separate cells Returns: total characters consumed Tokenizes the string bounded by s and len into cells, and stores at most *ncells resulting cells in the cells buffer. On return, *ncells is also set to the total cells stored in cells[]. size_t th_next_cell (const thchar_t *s, size_tlen, struct thcell_t *cell, intis_decomp_am) Get first cell from string. Parameters: s : the string len : the length of string cell : the output buffer is_decomp_am : whether SARA AM is to be decomposed into NIKHANIT and SARA AA and to be in separate cells Returns: total chars consumed by the cell Gets first cell from the string bounded by s and len, and, if cell is not null, stores the cell data in it. size_t th_prev_cell (const thchar_t *s, size_tpos, struct thcell_t *cell, intis_decomp_am) Get previous cell from string. Parameters: s : the string pos : the position in string to get cell previous to cell : the output buffer is_decomp_am : whether SARA AM is to be decomposed into NIKHANIT and SARA AA and to be in separate cells Returns: total chars consumed by the cell Gets last cell from the string bounded by s and pos, and if cell is not null, stores the cell data in it. Author Generated automatically by Doxygen for libthai from the source code. Version 0.1.14 Tue Jun 17 2014 thai/thcell.h(3)
All times are GMT -4. The time now is 08:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy