John is a web developer working through his own company John Dixon Technology Limited. As well as offering web development services, the company also develops and suppies a free accounting package called Earnings Tracker.
As well as the characters you can see in a web page (or any other text file), there are a whole host of hidden characters that you can't see. Most of the time you don't need to know where these characters are, which is why they are hidden in the first place. Occasionally though, perhaps when you need to perform some specific processing on one or more files, you need to find and display these characters. In this article I'll show how you can use a simple Perl script to find and display hidden characters in text files.
Here is the script:

The script initially finds all the files in the 'current' directory (folder) that end with '.txt'. If you wanted to find all the files that ended in '.htm' or '.html', for example, you would just need to change the '.txt' in the line containing the grep command.
The second part of the script makes a backup of each file found, which is always a good idea, and then searches through each file identifying and displaying (inside each file) the hidden characters found.
The characters that this script finds are the 'end of line' character, the 'end of file' character, the 'tab' character, and any control characters. You could of course edit the script to find different hidden characters if you wanted to.
The way the script finds and displays the characters is by using regular expressions. Regular expressions offer a very powerful way of searching for and (often) replacing strings within files. This script is written in Perl, which offers more support for regular expressions than any other language.
The regular expressions are contained in the lines beginning '$line ='. There are four of them in this script.
Running the Script
The script is designed to run on a local machine. Therefore, in order for it to work you will need to have a perl interpreter installed on your computer.
If you named the script 'hidden.pl', for example, you should be able to run it by double-clicking it from within Windows Explorer. Alternatively, you could open a command window, navigate to where the script (and files to be processed) are located, and type 'perl hidden.pl' at the command prompt.
- Related Videos
- Related Articles
- Ask / Related Q&A
- Perl Makes Life Easier
- Using Perl and Regular Expressions to Process Html Files - Part 1
- Using Perl and Regular Expressions to Process Html Files - Part 2
- Perl Development
- How To Quickly Use Perl Scripts In Windows
- Perle Systems Serial Cards Achieve Solaris Ready Compatibility
- Best Affordable Perl Hosting: Top 3 Perl Web Hosts
- Best Cheap Perl Hosting: Top 3 Perl Web Hosts




I am from Macedonia and also now am reading in English, give true I wrote the following sentence: "Dr stock pick, during this hedger of compound context in match securities, elgindy did markets how private look points grew and suffered foundations identify statutory charities."
Waiting for a reply :-), Chance.
Download to your Dsi-Find Out How You can Download Dsi Games To Your Dsi in a Few Minutes
By: Peter Jackson | 03/01/2010Well I am sure you love your Dsi it has many new futures up on the Ds, the ability to download games on your Dsi is one of the best features. Well many people have no idea how to download to Dsi. Well there are many ways to get a download to your Dsi. So if you looking for a site to get your Dsi downloads I have found one of the best Dsi download sites available on the web today.
PSPGoDownloadCenter.com – Is PSPGoDownloadCenter A Scam
By: Jack Corner | 03/01/2010Is PSPGoDownloadCenter a scam? You might be wondering the honesty that PSPGoDownloadCenter provide. If you have come across the website and need more information about the website before you decided to make a purchase, well this article is review about PSPGoDownloadCenter.com. PSP Go Download Center contains over 200,000 Downloads making it the Biggest Database for the PSP and PSP GO! PSP Go Download Center is complete database where you can find the newest and your favorite Games, Movies, Musi
Download Metal Gear Solid Peace Walker – PSP and PSP GO Game Download
By: Jack Corner | 03/01/2010Metal Gear Solid Peace Walker will be released on PSP handheld during 2010. Be patient the game is not coming out any sooner. If you want to pre-order the PSP UMD game from your local game store, I think you should save up your money and get your hand on the game for less than $0.01. Do you want to know where and how you can download the up-coming game Metal Gear Solid Peace Walker and your favorite PSP games for cheap? Visit PSP Go Download Center for more information.
Web Programming - Best Ways to Learn and Keep Motivated
By: Mike Ventura | 03/01/2010With each version of Microsoft Visual Studio.Net that is released from Redmond comes another learning session. This can either be fun or frustrating, it all depends on how you look at it.
Reports for silverlight
By: chaudhary fahim | 02/01/2010The following are procedures you can follow when using silverlight software.
PDF Reports
By: chaudhary fahim | 02/01/2010Portable document format is known as PDF that is popular file format.
How asp.Net Gauge control helps
By: Famous16 | 02/01/2010Data manipulation and control has been increasing in importance as we advance in the computer age.
Proactive Programmer
By: Muhammad Ali Siddiqui | 02/01/2010If you are reading this article then it is evidence enough that you want to move your career into the excellence path. To improve your skills and invest your time and energies in the direction where every moment you work should pile the success of your career.
Using Php to Validate Form Fields
By: John Dixon | 24/07/2008 | Web DesignThis article explains how to use PHP to validate data entered in form fields on a web page.
Finding Hidden Characters in a File
By: John Dixon | 27/06/2008 | ProgrammingIt is sometimes necessary to find hidden characters within one or more files.
Web Site Promotion Tips
By: John Dixon | 20/06/2008 | SEOWhen trying to get to the top of the search engine rankings there are certain things you should do, and other things you should not, in order to increase your chances of getting a top ten placement.
Exploiting Google Adsense
By: John Dixon | 08/04/2008 | Internet MarketingGoogle Adsense provides a great way to generate revenue from a web site.
Using Perl and Regular Expressions to Process Html Files - Part 2
By: John Dixon | 17/03/2008 | ProgrammingIn Part 1 we looked at what Perl and regular expressions are, and discussed how to use them to process ASCII files such as HTML files. In this part we'll develop a Perl script to process an HTML file.
Using Perl and Regular Expressions to Process Html Files - Part 1
By: John Dixon | 17/03/2008 | ProgrammingLike many web content authors, over the past few years I've had many occasions when I've needed to clean up a bunch of HTML files that have been generated by a word processor or publishing package. Initially, I used to clean up the files manually, opening each one in turn, and making the same set of updates to each one. This works fine when you only have a few files to fix, but when you have hundreds or even thousands to do, you can very quickly be looking at weeks or even months of work.
Size Really Does Matter
By: John Dixon | 14/03/2008 | SEOI believe that by following three basic rules, it is relatively easy to achieve a high ranking with the major search engines: 1. Add lots of relevant content; 2. Build up plenty of good quality inbound links; 3. Be patient.