How do I deal with (null) filenames?

Bob McGowen x922-4312 Training bob at wyse.wyse.com
Tue Aug 1 04:50:26 AEST 1989


In article <2131 at jhunix.HCF.JHU.EDU> bio_zwbb at jhunix.HCF.JHU.EDU (Dr. William B. Busa) writes:
>I am using some software which has a horrible bug -- it generates data
>files which have null names; for instance, ls will list these files as
---deleted---
>My question is this: how can I change these to manageable filenames? I
>realize that I can address these files as *.001, etc., but this does not
>solve my problem, because there will be lots of well-formed file names
---deleted---

If you are using the Bourne shell, the following pattern should work:

	[!!-~].???

The part to the left of the period says anything that is NOT (first
exclamation) in the range exclamation to tilde.  This means that ANY
control character would be found.  Also, only a single character is
matched.  If there should happen to be more than one null character,
you will need more of the patterns (probably just following it with
an asterix would work).  The part after the period can be any style
of pattern that will match the last three characters in the file name.

If you must exclude control characters also, you could try making
the pattern in a file with vi.  Use the ^V escape to enter a ^A (an
SOH character, DEC 1 in ASCII character set, follows NULL) and make
the pattern be:

	[!^A-~].???

In this case you would want to build a script around the pattern to
do the renaming for you.

Bob McGowan  (standard disclaimer, these are my own ...)
Customer Education, Wyse Technology, San Jose, CA
..!uunet!wyse!bob
bob at wyse.com



More information about the Comp.unix.questions mailing list