detecting consecutive filenames


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers detecting consecutive filenames
# 1  
Old 11-10-2009
detecting consecutive filenames

I have a series of filenames of the format junk_x_###.txt where x and ### are numbers. I need to detect when at least 30 consecutive files (e.g. junk_1_001.txt, junk_1_002.txt.....) are in the directory. There are sets of files with similar names that need to be grouped together and counted separately (e.g. junk_2_001.txt..., junk_3_001.txt....) and whichever cluster has more than 30 selected. I also need to allow for the consecutive filenames not beginning at 001 (e.g. junk_1_100.txt, junk_1_101.txt.....).

In essence I need to identify 30 consecutive files with identical filenames as far as junk_x_
What is the best strategy to take here? I'm trying to cluster the root of each filename, list them and then pipe to wc -l to count them but not getting the initial clustering to work well. Any suggestions for this step?
thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help in detecting errors

Hi All , I need a script to find errors in a particular and in a particular path Actually in my logs i`ve so many kinds of errors(i can even say as 100 types also).if i run the script i need to know the error (some errors can aviod ) so finally the script o/p should be a numeric... (3 Replies)
Discussion started by: radha254
3 Replies

2. Shell Programming and Scripting

detecting the part of a filename

I like to have the date in the 2008-09-01 format at the beginning of my filenames. I then hyphenate after that and then have my filename. I have a script that creates this for me. However, I may be working on files that already have the date format already in there and so I don't want to have a... (4 Replies)
Discussion started by: mainegate
4 Replies

3. Programming

Detecting interruptions in C

Hi. You may know how to detect when a interruption succeeded programming in C. Just like receiving a signal without blocking. Knowing when it was a keystroke (IRQ 2), or a mouse movement (12), or a disk access, etc. and getting actually for example the letter typed. Thanks a lot. (7 Replies)
Discussion started by: Ashrentum
7 Replies

4. UNIX for Dummies Questions & Answers

Detecting Second disk

Hello all, first of all, I apologise if I may ask stupid or obvious questions, but I'm new to UNIX and I think I need a little bit of help before I start gearing up :) Anyway, I have installed a Solaris 8 on a Sun machine, and it has 2 physical disks in it. However, it seems that it is only... (7 Replies)
Discussion started by: dragunu
7 Replies

5. Programming

Detecting a key combination

Could anybody tell me how I can detect a particular key combination and perform a particular task on that event. e.g. if I press Ctrl + L on the shell then it clears the screen. Please tell me how it can be performed on my shell. And how the Arrow Keys can be detected. I tried but pressing a key... (11 Replies)
Discussion started by: mobile01
11 Replies

6. Gentoo

Not detecting CD ROm drive

Hello All, I am pretty new to Linux, When trying to install TurboLinux 6.0 through a boot floppy, After a while it says to insert the CD and later it is not recognizing the CDROM, SO do we need to mount the CD-ROM before installation ?? Thanks in Advance :) S (13 Replies)
Discussion started by: sbasetty
13 Replies

7. Shell Programming and Scripting

detecting login or logout

what function would tell me that a user has logged in or out? i already know from my script the users name i already know in real time there was an event how an I tell if that event was a login or logout? Any ideas? # i did try comparing the file sizes for change but various users may... (8 Replies)
Discussion started by: nortypig
8 Replies

8. IP Networking

Detecting NIC in Solaris10

I have an E420 server that has a TPE Slot / NIC installed. However there is no interface file installed eg /etc/hostname.hme0 or equivalent. I have placed a private ip entry int the hosts file to accompany the loop back entry i.e. 127.0.0.1 localhost 172.16.0.10 loghost se420 ... (1 Reply)
Discussion started by: jimthompson
1 Replies

9. UNIX for Advanced & Expert Users

Detecting NIC in Solaris10

I have an E420 server that has a TPE Slot / NIC installed. However there is no interface file installed eg /etc/hostname.hme0 or equivalent. I have placed a private ip entry int the hosts file to accompany the loop back entry i.e. 127.0.0.1 localhost 172.16.0.10 loghost se420 ... (1 Reply)
Discussion started by: jimthompson
1 Replies

10. UNIX for Dummies Questions & Answers

detecting drives

I know that Unix is different from windows in that it needs more manual configuring but how do I get Solaris 8 (Intel version) to recognize my floppy drive and cd-rom?? I mean does it automatically detect the drives at startup and I have to mount them or do I have to create the drives somehow and... (1 Reply)
Discussion started by: eloquent99
1 Replies
Login or Register to Ask a Question
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -o a.txt -n b.txt e.txt Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)