file name cntrl character
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Shell > file name cntrl character




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    file name cntrl character  
Mr_Bill


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 01:11 PM

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









[ Post a follow-up to this message ]



    Re: file name cntrl character  
Stephane Chazelas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 01:11 PM

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





[ Post a follow-up to this message ]



    Re: file name cntrl character  
Mr_Bill


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 01:11 PM

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!







[ Post a follow-up to this message ]



    Re: file name cntrl character  
Jeremiah DeWitt Weiner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 11: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





[ Post a follow-up to this message ]



    Re: file name cntrl character  
Mr_Bill


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-20-06 01:13 PM

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





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:47 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register