awk search file then pipe to mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk search file then pipe to mail
# 1  
Old 06-08-2012
awk search file then pipe to mail

I need to write a script to search a static file (file1) in the form
Name Email
tim tfxo@gmail.com
bob bob@sss.com
and then mail them another file (file2) that is input from the command line.
The command line would be:
script.awk who file2 subject
and the result would be
mail -s subject who < file2
My centos is old and mail does not support -a
I am a novice so if there is a better way without awk please let me know.
Thanks in advance.
# 2  
Old 06-11-2012
Please post a sample of the expected contents of file2
# 3  
Old 06-11-2012
file2

file2 is the file that I want to email. It is simply a text file, for example, it may be a monthly report, a list of users, a financial statement. But it will always be a simple text file that will become the body to the email message.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk command to split pipe delimited file

Hello, I need to split a pipe de-limited file based on the COLUMN 7 value . If the column value changes I need to split the file Source File Payment|ID|DATE|TIME|CONTROLNUMBER|NUMBER|NAME|INDICATOR 42156974|1137937|10/1/2018|104440|4232|2054391|CARE|1... (9 Replies)
Discussion started by: rosebud123
9 Replies

2. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

3. Shell Programming and Scripting

BOTH pipe and file(s) into awk

Hello all, quick question: is it possible to pass input into AWK BOTH with a pipe AND a file at the same time, something like this: command .......|awk '.................' FILEIN > fileout All I read says either one or the other, not both, is it at all possible? And how would the... (2 Replies)
Discussion started by: gio001
2 Replies

4. Shell Programming and Scripting

New to Perl Mail @ sign search and replace in a file

HI I'm terribly new to perl .. I;ve been trying to use this command to search and replace entries in a file I tried this and it works perl -p -i -e 's/old/new/' filename Problem is that I have a list of email addresses and I need to serach and replace the entire email address as my... (5 Replies)
Discussion started by: mnassiri
5 Replies

5. UNIX for Dummies Questions & Answers

Use awk to pipe output from one file into multiple files

Hi All. Thanks for your help in advance. I have a requirement to examine the number of delimiters in each record of a file. If the record has the expected number of delimiters it should be passed into a 'good' file. If it does not, the record should be passed into a 'bad' file. I have been able... (8 Replies)
Discussion started by: codestar1
8 Replies

6. Shell Programming and Scripting

Bash Script Help...search then read from file: change text and pipe back...

Hello, I am trying to make a bash script that can pull data from a file and then change one part of said data. I want to search by username and pull the full line. That way there is a way to replace just one part of that line then return it back to the file. My Data is stored like: ... (1 Reply)
Discussion started by: serverfull
1 Replies

7. Shell Programming and Scripting

Awk to Search and Replace inside the pipe "|"

Hi, Anyone can help me on how to replace the qoutes inside the pipe | in my Text File like belows; "AAAA"|"Test "1-A""|"Test AAAA"|"This is A" "BBBB"|"Test "1-B""|"Test BBBB"|"This is B" "CCCC"|"My Test C"|"Test "CCCC""|"This is C" The output I need like belows; "AAAA"|"Test 1-A"|"Test... (12 Replies)
Discussion started by: fspalero
12 Replies

8. UNIX for Dummies Questions & Answers

Filtering mail into a named pipe

Hello, On my machine, all mail is stored in my /var/spool/mail. IS there a way to direct all mail that goes there into a namep pipe? Thank you, Dado (4 Replies)
Discussion started by: dadoprso
4 Replies

9. UNIX for Dummies Questions & Answers

Search for & edit rows & columns in data file and pipe

Dear unix gurus, I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this: adam peter blah blah blah blah blah blah car 01 30 200 02 31 400 03 57 121 .. .. .. .. .. .. n y... (8 Replies)
Discussion started by: tintin72
8 Replies

10. UNIX for Dummies Questions & Answers

AWK Pipe (truncate last few lines from file)

Hello, does anybody have a clue why the following code isn't working in csh: awk 'END{print FNR-5}' x.log | awk 'FNR<$1' x.log > x2.log I want to remove the last 5 lines of a file without using a variable. Thanks Tim (2 Replies)
Discussion started by: uxuser
2 Replies
Login or Register to Ask a Question