![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep with special characters | guruparan18 | UNIX Desktop for Dummies Questions & Answers | 3 | 06-12-2008 05:58 AM |
| How to find special characters?? | sumitc | AIX | 3 | 05-04-2008 08:20 PM |
| Handling special characters using awk | sam_78_nyc | Shell Programming and Scripting | 3 | 11-08-2007 05:55 PM |
| special characters | nawnaw | UNIX for Dummies Questions & Answers | 2 | 05-18-2004 03:17 PM |
| awk/sed with special characters | apalex | Shell Programming and Scripting | 5 | 05-06-2002 04:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
get rid of special characters
Hi Friends,
we have recently installed RHEL4.4 and when i give the commd ls -l > tt it prints the file name with some special charactes like ^[[00m1 in the begining of the file name and at the end of the file name. I wanted to use the file names of removing it before taking the backup and to use in awk script I want to remove the unprintable characters . I have tried sed 's/^[...../p' input file > output file , but the characters varies in their lenght so unable to remove . kindly guide .. Thanks in advance for help. ![]() |
|
||||
|
It's real DATA ANALYSIS!
Why are you using "ls -l" if all you want is the names? Try ls -1.. That will simplify things for you... As for the special characters, get used to "od" Octal Dump.... Look at the hex values... try ls -1 | od -cx > somefile Then you can actually see what values are in those "unprintable" columns. Impossible to tell from what you write here because every character set interprets those values differently.... Once you know what the characters really are (in hex) you can come up with a way of eliminating them... Still, I don't know what RHEL is... Is it real unix? |
|
||||
|
RHEL is Red Hat Enterprise (mumble) something, i.e. Linux.
Maybe it's as simple as "unalias ls". Some distros provide an alias which enables directory coloring, which will output some escape codes to provide text in different colors. If your terminal doesn't understand those escape codes, you would see something like what you describe. |
|
||||
|
Escape codes... Colors...
Yes makes sense. Hadn't thought of that. I've got a little project of my own that requires getting rid of escapes like that (simple perl pattern). I wondered what they might be for, now I remember... thanks $INPTBffr =~ s/[^\x0A\x0D\x20-\x7E]+//g; Using something like the above to strip binaries, and newlines leaving pure text stream..... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|