Possible to combine inline redirection with pipes?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Possible to combine inline redirection with pipes?
# 1  
Old 12-02-2009
[SOLVED] Possible to combine inline redirection with pipes? [YES!]

Would like to use a here document in a shell script with sqlplus and pipe the output to sed (etc.) before ultimately redirecting the lot to a file, e.g:

Code:
# sqlplus -S user/pass <<EOF
SELECT *
FROM table
quit
EOF | sed 's/[<space><tab>]//g' > outputfile

Have tried various permutations to no avail. Any ideas? Is it even possible?!

---------- Post updated at 09:12 AM ---------- Previous update was at 09:04 AM ----------

Seek and ye shall find (inspiration) - doh!

Solution:

Code:
# sqlplus -S user/pass <<EOF | sed 's/[<space><tab>]//g' > outputfile
SELECT *
FROM table
quit
EOF


Last edited by cs03dmj; 12-02-2009 at 05:19 AM.. Reason: Solved.
# 2  
Old 12-02-2009
Try:


Code:
echo "$(sqlplus -S user/pass <<EOF
SELECT *
FROM table
quit
EOF 
)"| .....

# 3  
Old 12-02-2009
MySQL

Quote:
Originally Posted by dennis.jacob
Try:


Code:
echo "$(sqlplus -S user/pass <<EOF
SELECT *
FROM table
quit
EOF 
)"| .....

Thanks Dennis - I've posted the solution I worked out above, but yours works too!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Grep inline use perl

Hi, i have input like this : SS-ID VLAN MAC TIME IP RSSI MODE UAPSD BW GI WMOS DHCP IDENTITY ----- ---- --- ---- -- ---- ---- ----- -- -- ---- ---- -------- 1-1 0 C4:46:19:75:C1:55 23m 192.168.5.253 ... (5 Replies)
Discussion started by: justbow
5 Replies

2. Shell Programming and Scripting

How to combine these to pipes?

ls --color=always -laX | awk '{print $1, $3, $4, $2, $8}' |sort -k 1,1 -k 9,9r they work separately... but i don't know how to combine this to work. thx! (1 Reply)
Discussion started by: surreal7z
1 Replies

3. Post Here to Contact Site Administrators and Moderators

inline code tags

How to add inline tags in the posts? Like in this thread post #4. Thanks. (5 Replies)
Discussion started by: clx
5 Replies

4. Homework & Coursework Questions

Using Pipes and Redirection

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a pipe to show the number of people who are logged into the system right now. Create a pipe to show... (2 Replies)
Discussion started by: lakers34kb
2 Replies

5. UNIX for Advanced & Expert Users

inline redirect stdin

Hi: I have the next script on ksh #!/usr/bin/ksh cd $FUENTES qdesign <<-! \$/opt/cognos/ph843e/bin/qtp <<-! \$/opt/cognos/ph843e/bin/quiz <<-! ! ! ! This script is very simple, i want to nest three process quiz into qtp, and this into qdesign. When I run it , i receive the next... (2 Replies)
Discussion started by: ct2marer
2 Replies

6. Shell Programming and Scripting

inline redirect stdin

Hi: I have the next script on ksh #!/usr/bin/ksh cd $FUENTES qdesign <<-! \$/opt/cognos/ph843e/bin/qtp <<-! \$/opt/cognos/ph843e/bin/quiz <<-! ! ! ! This script is very simple, i want to nest three process quiz into qtp, and this into qdesign. When I run it , i receive the... (5 Replies)
Discussion started by: ct2marer
5 Replies

7. Shell Programming and Scripting

Array Printing Inline

Dear friends , The output file of below script Pls#!/bin/sh awk '{ bo = substr($0,13,3) slm = substr($0,150,8) slo = substr($0,175,7) inc = substr($0,97,10)/100 busi = substr($0,83,10) mth = substr($0,39,2) yer = substr($0,35,4) ... (2 Replies)
Discussion started by: vakharia Mahesh
2 Replies

8. Shell Programming and Scripting

Inline Parameters-Urgent

Can someone tell me how to enter inline parameters with script call? This is a little urgent so some help would be highly appreciated. Thanks a lot. Indira (2 Replies)
Discussion started by: indira
2 Replies

9. Shell Programming and Scripting

how to use pipes + redirection to create two files?

# this works # creates two.txt (echo one;echo two;echo three;) | ( ( grep two > two.txt ) ) # wamt this to create two files: # two.txt containing "two" and three.txt containing "three" # Both files get created, but three.txt is empty # is there a way to do this? (echo one;echo two;echo... (3 Replies)
Discussion started by: tphyahoo
3 Replies

10. Filesystems, Disks and Memory

PIPEs and Named PIPEs (FIFO) Buffer size

Hello! How I can increase or decrease predefined pipe buffer size? System FreeBSD 4.9 and RedHat Linux 9.0 Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
Login or Register to Ask a Question