Skip to contentSkip to conversation

Getting ls results in text file - Charset issue

DISCUSSION ACario 3 participants 5 messages Dec 21, 2004 – Dec 22, 2004

lore
Share & tools
lore

ACario

author
#0 lore raw

Hi,

I'm running following command in a console:

ls > out.csv

Then I open the file "out.cvs" in vi and here is what I get, whith all these strange characters (below is a copy/paste from vi screen):

^[[00m^[[01;34mcxoffice^[[00m/
^[[01;34mDesktop^[[00m/
^[[01;34mGNUstep^[[00m/
^[[01;34mkde^[[00m/
^[[01;34mLogs^[[00m/
^[[01;34mNntp^[[00m/
^[[00mNOTEBOOK.DBF^[[00m
^[[00mout.csv^[[00m
^[[01;34mSw^[[00m/
^[[01;34mSwWork^[[00m/
^[[01;34mtmp^[[00m/
^[[01;34mWorkspace^[[00m/

My config: Mandrakelinux 10.1, bash
My question: how can I get the results of my "ls" command in a plain text file with ASCII or ISO-8891 character set instead of all this unreadable characters?

Thanks

ACario

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 9 lines · ACario

I'm running following command in a console:
ls > out.csv
Then I open the file "out.cvs" in vi and here is what I get ^[[00m^[[01;34mcxoffice^[[00m/ ^[[01;34mDesktop^[[00m/
^[[01;34mGNUstep^[[00m/
^[[01;34mkde^[[00m/
^[[01;34mLogs^[[00m/

It appears your ls is aliased to show colors.
You could unalias it or try the following:
-----------------
/bin/ls > out.csv
-----------------

Cheers,
Steven

____________________________
http://www.basiclinux.com.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw
In reply to ACario

Hi,

don't ask me why, but these characters look more like ANSI escape sequences (everything prefixed with an ESC (^[ ) ) .looks like your console is giving you the raw data it receives instead of just the text......

regards,
Joy.M.Monteiro

Quoted 37 lines · ACario

Hi,

I'm running following command in a console:

ls > out.csv

Then I open the file "out.cvs" in vi and here is what I get, whith all these strange characters (below is a copy/paste from vi screen):

^[[00m^[[01;34mcxoffice^[[00m/
^[[01;34mDesktop^[[00m/
^[[01;34mGNUstep^[[00m/
^[[01;34mkde^[[00m/
^[[01;34mLogs^[[00m/
^[[01;34mNntp^[[00m/
^[[00mNOTEBOOK.DBF^[[00m
^[[00mout.csv^[[00m
^[[01;34mSw^[[00m/
^[[01;34mSwWork^[[00m/
^[[01;34mtmp^[[00m/
^[[01;34mWorkspace^[[00m/

My config: Mandrakelinux 10.1, bash
My question: how can I get the results of my "ls" command in a plain text file with ASCII or ISO-8891 character set instead of all this unreadable characters?

Thanks

ACario

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Signature · 10 lines
people always turn away,
from the eyes of a stranger...
Afraid to know
what lies behind the stare.......
    --QueensRyche
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
#4 lore raw
Quoted 9 lines · joy merwin monteiro

these characters look more like ANSI escape sequences (everything prefixed with an ESC (^[ ) )

Quoted 5 lines

^[[00m^[[01;34mcxoffice^[[00m/
^[[01;34mDesktop^[[00m/
^[[01;34mGNUstep^[[00m/
^[[01;34mkde^[[00m/
^[[01;34mLogs^[[00m/

They are color codes. 34m = blue. 00m = off.

Cheers,
Steven

____________________________
http://www.basiclinux.com.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

author
#2 lore raw
In reply to [email protected]
Quoted 12 lines · [email protected] wrote:
Quoted 8 lines · ACario

I'm running following command in a console:
ls > out.csv
Then I open the file "out.cvs" in vi and here is what I get ^[[00m^[[01;34mcxoffice^[[00m/ ^[[01;34mDesktop^[[00m/
^[[01;34mGNUstep^[[00m/
^[[01;34mkde^[[00m/
^[[01;34mLogs^[[00m/

Quoted 4 lines

It appears your ls is aliased to show colors. You could unalias it or try the following:
-----------------
/bin/ls > out.csv
-----------------

Exaclty! Thanks for the info.

Cheers

ACario

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs