Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > ? Terminal command for listing groups of files...

? Terminal command for listing groups of files...
Thread Tools
kent m
Mac Enthusiast
Join Date: Apr 2001
Location: ~
Status: Offline
Reply With Quote
Jan 19, 2007, 10:30 AM
 
Hi ho,

Is there a command for the osX terminal - bash - that will list sequentially numbered groups of file as one line instead of individually, while listing other files and directories correctly?

Meaning that a group of files:

image.001.tif
image.002.tif
image.003.tif
image.004.tif
image.005.tif

would be listed as

image.001-005.tif


and a dir with other files and dirs:

image.001.tif
image.002.tif
image.003.tif
image.004.tif
image.005.tif
dir01/
dir02/
imageB.tif

in it would be:

image.001-005.tif
dir01/
dir02/
imageB.tif

?

Wold love to have this...

Thanks,
KM

kent m is not a member of any public groups
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Jan 19, 2007, 07:49 PM
 
A command? Well, certainly no standard bash command (AFAIK).
But someone may have written such a script/tool. That's what it
would take I think. (And none too trivial either).

Well, the folder part would be easy. Not sure how to attack the
file-ranges portion. (You just need someone smarter than me!).

That shouldn't be too hard to find.
At any rate, it'll take some scripting.
-HI-
     
kent m  (op)
Mac Enthusiast
Join Date: Apr 2001
Location: ~
Status: Offline
Reply With Quote
Jan 20, 2007, 02:09 AM
 
Yeah, a company I used to work for had a cmd on linux that would do this - very very useful - and I hopefully can dig it up. I thought I'd try here though - never realized it would be so unique.

kent m is not a member of any public groups
     
larrinski
Mac Enthusiast
Join Date: Sep 2005
Location: Canada... be nice, eh?
Status: Offline
Reply With Quote
Jan 20, 2007, 03:50 PM
 
maybe try The UNIX Forums - the Top UNIX & Linux Q&A on the Web which is the unix forum. Lots of unix geeks there!
My Blog-pakos.me
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Jan 22, 2007, 07:43 PM
 
Almost certainly it will be written in Perl
(which is about as legible as shorthand).
-HI-
     
kent m  (op)
Mac Enthusiast
Join Date: Apr 2001
Location: ~
Status: Offline
Reply With Quote
Jan 24, 2007, 02:39 PM
 
Thanks very much for the input. If I get ahold of something that isn't proprietary I'll post it back here. I had no idea that this would be such a hard thing to find!

best,
K

kent m is not a member of any public groups
     
jprice
Fresh-Faced Recruit
Join Date: Jan 2007
Status: Offline
Reply With Quote
Feb 1, 2007, 04:41 PM
 
have you tried using sed and awk?

something like

ls ./*.tiff|sed 'y/./ /'|awk '{print $2}'

just put it in a variable get first output lastoutput and print string $1 .firstinput-lastoutput.tif
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 12:50 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,