The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Combine output on same line theninja Shell Programming and Scripting 3 01-14-2008 04:21 AM
Logging commands and output soliberus SUN Solaris 3 10-25-2007 07:30 AM
Interpreting java output stream as system commands in Solaris EugeneG UNIX for Dummies Questions & Answers 1 07-18-2007 06:45 PM
Output of 2 commands into 1 file enuenu UNIX for Dummies Questions & Answers 8 03-14-2007 07:22 AM
Output all commands to logfiles ??? fawqati UNIX for Advanced & Expert Users 2 06-21-2006 04:47 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-13-2007
33junaid 33junaid is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 27
Combine Two Commands Output

How i can combine output of two commands in one file.......i tried this but it is not working although each command is working good seperately.....


head -1 filename | tail -1 filename


i think there is problem with command concatenator?
  #2 (permalink)  
Old 08-13-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Code:
(head -1 filename; tail -1 filename )> newfilename
Hope you are trying to print the first and last line to a new file

Last edited by lorcan; 08-13-2007 at 07:11 AM..
  #3 (permalink)  
Old 08-13-2007
33junaid 33junaid is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 27
Yes that is done.Thanks....wat if I want to insert some word in between the 2 commands but on same line?

head -1 filename; "Some Text" ; tail -1 filename > newfilename

it is taking "Some text" as command instead of text.......how to combine text now?
  #4 (permalink)  
Old 08-13-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Code:
(head -1 filename; echo "Some Text" ; tail -1 filename )> newfilename

Last edited by lorcan; 08-13-2007 at 07:12 AM..
  #5 (permalink)  
Old 08-13-2007
33junaid 33junaid is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 27
the second command after the echo starts in new line not on the same line.........
  #6 (permalink)  
Old 08-13-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Use the -n option in echo if you want to display it in a single line.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0