The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to perform some actions on multiple files heprox AIX 2 06-12-2006 12:31 PM
Script to delete all data from multiple files uni_ajay_r Shell Programming and Scripting 5 03-29-2006 08:05 AM
Need a script to delete multiple files navycow UNIX for Dummies Questions & Answers 3 01-16-2006 11:50 AM
Combining Multiple files in one in a perl script rahulrathod Shell Programming and Scripting 1 12-17-2005 10:51 PM
What are core files and how can I delete them when am performing system maintenance?? IMPORTANT UNIX for Dummies Questions & Answers 6 04-04-2002 12:39 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-16-2008
Registered User
 

Join Date: Feb 2008
Posts: 38
Performing Script on Multiple Files

Dear All

I have group of files named :

CDR.1,CDR.2.,CDR.3,CDR.4,CDR.5,CDR.6,etc.......

I am performing an awk command look like this : nawk -f script CDR.*

What i want is that i want to perform this command on range of files not all of them.

Instead of writing CDR.* i want to write from CDR.1 to CDR.3.

Please Advise
Best Regards
Zanetti
Reply With Quote
Forum Sponsor
  #2  
Old 04-16-2008
Moderator
 

Join Date: Dec 2003
Location: /dev/fl
Posts: 1,061
Try CDR.[1-3]
Reply With Quote
  #3  
Old 04-16-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Handle three at a time, for as long as there are any left?

Code:
echo CDR.* | xargs -n 3 nawk -f script
Reply With Quote
  #4  
Old 04-16-2008
drl's Avatar
drl drl is offline
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 556
Hi.

The order of the files produced by the shell may not be what you expect, so use caution if the order is important. For example:
Code:
#!/bin/bash3 -

# @(#) s1       Demonstrate list sequence from shell for numeric sub-strings.

echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1)
echo

# Manufacture the list, and remove previous debris.
LIST=$( printf "t%d " {5..12} )
rm -f $LIST

# Create the files.
touch $LIST

echo ' Results from echo t*:'
echo t*

exit 0
Producing:
Code:
% ./s1

(Versions displayed with local utility "version")
Linux 2.6.11-x1
GNU bash 3.00.16(1)-release

 Results from echo t*:
t10 t11 t12 t5 t6 t7 t8 t9
Best wishes ... cheers, drl
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0