fhg
Volume 6, Number 34 -- September 20, 2006

Redirecting a List of Qshell Commands

Published: September 20, 2006

Hey, Ted:

I need a little help with a Qshell script. I retrieve a list of IFS files that have a certain extension (a suffix precede by a period) and pipe the list into another process. Now I have to also include other files that have a completely different extension. I do not want to run the command twice, processing each type of file in turn. How do I redirect the output of more than one command into one output stream?

--Brad


OK, let's set up the problem for the benefit of the readers. Suppose Brad's script currently processes files with the extension .TXT. Case of the extension is immaterial.

ls *.[Tt][Xx][Tt] | sort -f > somefile

Now he has to include .CSV files as well. The solution is to replace the single ls command with a list of commands. Just follow these easy steps.

  • Precede the first one in the list with an opening brace and a space
  • Terminate each command with a semicolon
  • Conclude the list with a closing brace

Brad's new command is the following:

{ ls *.[Tt][Xx][Tt]; ls *.[Cc][Ss][Vv]; } | sort -f > somefile

All of the TXT and CSV files will be directed to the sort routine as one input stream.

The braces force Qshell to process the commands concurrently. I have used the ls command in this illustration, but you may use any command that writes to standard output.

--Ted



Sponsored By
T.L. ASHFORD

BARCODE400 by T.L. Ashford is the easiest, fastest way to create and print Compliance Labels directly from the AS/400 and iSeries.

Ashford's comprehensive library of Compliance formats is available to Barcode400 users. AIAG labels for Ford and Motorcraft, GM, and many more are available.

BARCODE400 is backed by the best Technical Support Team in the industry.

FREE Guide to Bar Code Labeling
www.tlashford.com
or call 800.541.4893



Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

Bug Busters Software Engineering:  Quality software solutions for the iSeries since 1988
PowerTech:  Your security expert for the iSeries and AS/400
COMMON:  Join us at the Spring 2007 conference, April 29 – May 3, in Anaheim, California

 


 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement