Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finding new line character or special characters in txt file ?

 
kri shan
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 11888
203
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic