The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Hidden Characters Khoomfire UNIX for Advanced & Expert Users 6 07-06-2007 05:40 AM
Formatting a text file based on newline and delimiter characters ntekupal Shell Programming and Scripting 5 05-11-2007 04:33 PM
missing hidden characters SUSANR9999 UNIX for Dummies Questions & Answers 2 11-09-2006 04:30 PM
Randomly appearing control characters in text files aakashahuja AIX 0 07-18-2006 06:26 AM
Identifying and removing control characters in a file. oracle8 High Level Programming 0 04-13-2004 07:08 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 05-29-2002
kewl_guy kewl_guy is offline
Registered User
  
 

Join Date: May 2002
Posts: 1
Question Hidden control characters in a Unix Text File!

Can anyone seem to know how to find out whether a UNIX text file has 'hidden' control characters?

Can I view them using 'vi' by some command line options?

If there are control characters in a text file which are invisible/hidden.. then how do I get rid of them?

Your intelletual answers are greatly appreciated.

Thanks in anticipation.
  #2 (permalink)  
Old 05-29-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
try the :set all in command mode in vi. It will list all the available options.

See what that tells you. I think that the :I will show (using the letter "I") newline and various special characters.

Hope this helps.
  #3 (permalink)  
Old 05-30-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
vi does not work well with binary data. I suggest that you stay away from vi for this issue. To display the data you can use either "cat -v" or "od -c". Once you know what you're dealing with, "tr -d" can delete unwanted bytes.
  #4 (permalink)  
Old 05-30-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Surely VI is okay for text file though?

Using ":set list" in vi will tell you any tab's (^I) and show whitespace by giving you the eol character '$'

Don't know how good this is for other 'special characters' etc.
  #5 (permalink)  
Old 09-16-2008
ghiotion ghiotion is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 1
Don't know if this helps, but python can give you a quick view of the control characters in the file.
python -c "f = open('filename.txt', 'r'); f.seek(0); file = f.readlines(); print file"
Just replace filename.txt with your filename.
  #6 (permalink)  
Old 09-30-2008
balan_mca balan_mca is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 15
Thumbs up how to remove a special char and whitespace char in a file

Hi pals,

Could you guys clear my doubts?..

I want to remove all white space chars, ctrl key chars, arrow key chars, Esc key char and del key chars...

for ex..

Get the input value[ while typing use all arrow keys/del keys/esc key]
and store it one file. for example you can get this input value as Hello^[[AHow a^[[D]re you^[ "


but, I wanna the o/p will be

Hello How are you?

plz, solve my query guys

Thnx in advance
  #7 (permalink)  
Old 09-30-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
How do you know the A before How is not part of the input?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0