LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2003, 07:35 AM   #1
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Bash: How to concatenate the output of different commands?


I want to concatenate the output of an echo and a grep command, and pipe them to smbclient, which shall send them as a message.

I tried:
echo "sometext" ; grep searchstring /path/to/file | smbclient -M addressee

The above command printed "sometext" onto the screen, and only piped the output of the grep command to smbclient to send it as a message.

Also, I want to put a newline in the message between the output of the echo and grep commands. (Naturally, newlines in the output of the grep command should also be kept)

Anyone knoing how to do this?

Last edited by J_Szucs; 11-13-2003 at 07:36 AM.
 
Old 11-13-2003, 07:43 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
(echo -e "blah\n"; grep something) | smbclient....

should do you fine, i can never get newline's in echo right though... so don't quote me on that bit.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux commands - giving doubled output shinobi59 Red Hat 1 11-07-2005 06:43 PM
[Bash] Concatenate string using awk senorsnor Programming 7 05-05-2005 12:38 AM
Using commands to output to files, how is this done? nro Linux - Newbie 3 11-11-2003 08:38 PM
how to read the output of df -k and about logical volumes commands jdara1 Linux - Software 3 05-23-2003 12:22 PM
Bash commands wprescott Linux - Distributions 6 04-27-2002 02:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration