Read pipe data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read pipe data
# 1  
Old 12-11-2012
Read pipe data

Hello,

I need to read the pipe data as:-

Code:
cat abc.txt | uuencode abc.txt | mailx -s hi xyz@xyz.com

I will override the mailx function so that when mailx is called, it calls my version of maix and in that function I want to read the file which is attached in progional mailx function- abc.txt

Once done, I can do whatever I want with this data...sending it to somebody else rather to intended receipient....

Is there any way to it?

Thanks

Last edited by Scott; 12-11-2012 at 01:47 PM.. Reason: Code tags
# 2  
Old 12-11-2012
Why do you need to override mailx instead of just sending mail to the correct people in the first place, or altering sendmail's settings to do what you want?
# 3  
Old 12-11-2012
In the project I am working for, the requirement is that, the mails should not go to intended users if we are on Non Production server.

We dont want to change the codes where email addresses are hard coded or are taken from external files.

Something to handle at run time...
# 4  
Old 12-11-2012
I think it would make sense to change your mail server than your code. Otherwise it's not really been tested.

"intercepting" a command is going to be very awkward at best.

I suppose you could have a MAILX variable, and use $MAILX instead of mailx for your mail command, and alter the variable when your program begins depending on the hostname.
# 5  
Old 12-11-2012
Ok, thanks for the suggestion.

Please let me know, what needs to be done in order to handle it via changing the mail server?
# 6  
Old 12-11-2012
What's your mail server?
# 7  
Old 12-11-2012
I am not sure of it as of now...have not digged into it and have little knowledge about it. All I know is, it is somewhere defined in /etc/mail folder.

The codes that I need to handle use mailx or sendmail commands to send mail.

Please let me know further on it.

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX Pipe -Exit when there are no bytes to read

Hi All, I'm creating a program which reads millions of bytes from the PIPE and do some processing. As the data is more, the idea is to read the pipe parallely. Sun Solaris 8 See the code below: #!/bin/sh MAXTHREAD=30 awk '{print $1}' metadata.csv > nvpipe & while do ... (3 Replies)
Discussion started by: mr_manii
3 Replies

2. Shell Programming and Scripting

UNIX fifo concurrent read from a named pipe

I have created a fifo named pipe in solaris, which writes the content of a file, line by line, into pipe as below: $ mkfifo namepipe $ cat books.txt "how to write unix code" "how to write oracle code" $ cat books.txt >> namepipe & I have a readpipe.sh script which reads the named... (2 Replies)
Discussion started by: naveen mani
2 Replies

3. Shell Programming and Scripting

While read pipe input issue

Hello, I have an ffmpeg bash script which is working nice and I need to do the same for other sources. To create new scripts and to deal with multiple bash files sounds not logical. It is a bit hard to manage for me.. I wondered if it was possible to make my input file as variable. Then I... (1 Reply)
Discussion started by: baris35
1 Replies

4. UNIX for Dummies Questions & Answers

No process to read data written to a pipe on AIX

We use SAP application cluster on AIX. Communication between 2 of its instances is failing randomly with the following error: java.net.SocketException: There is no process to read data written to a pipe. The above error causes a cluster restart if an important communication fails. Can... (0 Replies)
Discussion started by: RoshniMehta
0 Replies

5. Shell Programming and Scripting

Read from a pipe or die in perl

I have a perl program that I want to read from a file passed as an argument or from a pipe. If their is no pipe or arguments, I want it to output a help message. I am stuck on how to prevent perl from reading from the keyboard if it isn't fed any file names or data from a pipe. The only things I... (4 Replies)
Discussion started by: ilikecows
4 Replies

6. AIX

Tape drive problem - no process to read data written to a pipe

Hi Everyone, The machine I'm working on is an AIX 5.3 LPAR running on a P650. oslevel -r shows 5300-08. I'm trying to take a backup to a SCSI tape drive, which has been working up until this point. I know of nothing that has changed recently to cause this problem. But when I try to take a... (0 Replies)
Discussion started by: need2bageek
0 Replies

7. UNIX for Advanced & Expert Users

AIX 5.3 - There is no process to read data written to a pipe

I have the following code which works on AIX 4.3 but fails at times on AIX 5.3 with: cat: 0652-054 cannot write to output. There is no process to read data written to a pipe. validator="${validator_exe} ${validator_parms}" cmd_line="${CAT} ${data_file} | ${validator}... (6 Replies)
Discussion started by: vigsgb
6 Replies

8. Programming

pipe read and write with many forked children

I know how to read and write if i have a forked process with only one child. However what is involved with reading and writing with many forked processes. Say one parent that forks 5 children, and needs to communicate with all 5 in half duplex. int temp, counter=0; do{ pipe(temp); ... (5 Replies)
Discussion started by: steveneliuk
5 Replies

9. Programming

Problem in read() from a pipe

Hi, Can any one please help me with this. Am struggling hard to get a solution. I am doing telnet through a C program and getting the stdout file descriptor of the remote machine to pipe. read() function is getting data, But whenl it receives SOH character ie. ^A ( Start of heading = Console... (2 Replies)
Discussion started by: JDS
2 Replies

10. Shell Programming and Scripting

read after pipe problem OSX10.4

I use read often in scripts to filter the right part into a variable like: $ print "abc cde efg" | read k l ; print "k=$k, l=$l" k=, l= This works on linux and unix versions I work with. On OSX 10.4 this doesn't work. I found a workaround but would like to know why the original line... (5 Replies)
Discussion started by: relyveld
5 Replies
Login or Register to Ask a Question