|
Home > Archive > Unix Shell > January 2006 > file name cntrl character
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
file name cntrl character
|
|
| Mr_Bill 2006-01-19, 8:11 am |
| I have a directory that I copied from a dvd in XP to
fat32 then copied that directory in linux to my reiser
home directory.
It has 13,000 PDF files.
ls | grep [:cntrl:] | cat -n shows 3833 file names
that have control charachters in them.
How can I view what these control charachters are?
Thanks,
Mr_Bill
| |
| Stephane Chazelas 2006-01-19, 8:11 am |
| On Thu, 19 Jan 2006 09:30:38 GMT, Mr_Bill wrote:
> I have a directory that I copied from a dvd in XP to
> fat32 then copied that directory in linux to my reiser
> home directory.
> It has 13,000 PDF files.
>
> ls | grep [:cntrl:] | cat -n shows 3833 file names
> that have control charachters in them.
No, if there's a file called :, c, n, t, r or l in the current
directory, the shell will change that command line to:
ls | grep r | cat -n
for instance.
If not, it will stay:
ls | grep [:cntrl:] | cat -n
that shows the files whose name contains :, c, n, t, r or l.
If you want to search for control characters, then it's:
ls | grep '[[:cntrl:]]' | cat -nvt
remember "[" is special to the shell, so must be quoted.
>
> How can I view what these control charachters are?
[...]
That's the -v and -t flags.
You can also use od -tc or sed -n l
~$ echo '\a' | od -tc
0000000 \a \n
0000002
~$ echo '\a' | sed -n l
\07
~$ echo '\a' | cat -vt
^G
--
Stephane
| |
| Mr_Bill 2006-01-19, 8:11 am |
| On Thu, 19 Jan 2006 10:35:35 +0000, Stephane Chazelas wrote:
> ls | grep '[[:cntrl:]]' | cat -nvt
>
> remember "[" is special to the shell, so must be quoted.
Alright! That works!
Thankin' You!
| |
| Jeremiah DeWitt Weiner 2006-01-19, 6:24 pm |
| Stephane Chazelas <stephane_chazelas@yahoo.fr> wrote:
> If you want to search for control characters, then it's:
> ls | grep '[[:cntrl:]]' | cat -nvt
> That's the -v and -t flags.
Wouldn't it be simpler to use the -b or -Q flag to ls? Those are
GNU options, but since the OP said he had Linux, he should have those
available to him. I'm also not sure your example works for everything:
sadalsuud:/tmp$ ls ???
?d? ?d?
sadalsuud:/tmp$ ls | grep '[[:cntrl:]]' | cat -nvt
1 ^Hd^Q
2 d^M
sadalsuud:/tmp$ ls -1b ???
\bd\021
\nd\r
Note that the cat method has lost the "\n" off the second file.
--
Oh to have a lodge in some vast wilderness. Where rumors of oppression
and deceit, of unsuccessful and successful wars may never reach me
anymore.
-- William Cowper
| |
| Mr_Bill 2006-01-20, 8:13 am |
| On Thu, 19 Jan 2006 10:35:35 +0000, Stephane Chazelas wrote:
> If you want to search for control characters, then it's:
>
> ls | grep '[[:cntrl:]]' | cat -nvt
I forgot to mention, when then double brackets worked, it made me
mad.
The fricken book I paid $40.00 dollars for doesn't show double
brackets.
Right here, on page 152, it shows....
[[:cntrl:]]
Uhmmmm, never mind, LOL
Mr_Bill
|
|
|
|
|