The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
implicitly redirecting stdout to a file ALTRUNVRSOFLN Shell Programming and Scripting 1 09-23-2008 03:42 PM
Redirecting STDERR message to STDOUT & file at same time vikashtulsiyan Shell Programming and Scripting 10 04-09-2008 02:34 PM
Redirecting OUTPUT Chanakya.m Shell Programming and Scripting 1 08-13-2007 04:27 PM
redirecting STDOUT & STDERR jshinaman Shell Programming and Scripting 9 06-22-2007 12:04 AM
Redirecting the startup output blakmk UNIX for Dummies Questions & Answers 3 10-28-2003 07:22 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 10-15-2008
Legend986 Legend986 is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 171
Redirecting part of output to stdout

Hi,

I am trying to execute a command like this:

Code:
find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output
If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the filenames into stdout with the rest of the output into the file? Any help is much appreciated.

EDIT: Ah... Figured out... Sorry... Here's the solution:

Code:
find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk >> output' \;
The solution was to put the redirection inside the exec itself...
  #2 (permalink)  
Old 10-17-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
Well done!
  #3 (permalink)  
Old 10-17-2008
Legend986 Legend986 is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 171
Thank You Just learning Unix so got curious in messing around with things...
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 04:17 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