This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Finding new line character or special characters in txt file ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Reply Bookmark "Finding new line character or special characters in txt file ?" Watch "Finding new line character or special characters in txt file ?" New topic
Author

Finding new line character or special characters in txt file ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1300
How to check(using script/command line) any new line character or special characters in the text file(.txt) in Unix/Linux.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 10816
    
  25

What are you trying to achieve?

If all you want to do is count how many lines are in a file, you might want to look at the wc program.

If you want to be able to count specific characters, you might want to look at the grep command (take a look at the '--count' option).


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Andrew Monkhouse wrote:If you want to be able to count specific characters, you might want to look at the grep command (take a look at the '--count' option).

But grep counts matching rows, not characters.


http://home.arcor.de/hirnstrom/bewerbung
 
 
subject: Finding new line character or special characters in txt file ?
 
Similar Threads
Reading alarge file and wrapping content
illegal space character
Readin a txt file to populate into the database
interesting problem in char
How to store the newlines entered by enter key in textarea?