LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-07-2003, 11:02 AM   #1
professorfrink
LQ Newbie
 
Registered: Oct 2003
Location: Winnipeg Manitoba Canada
Distribution: Gentoo
Posts: 12

Rep: Reputation: 0
Using Regular Expressions to find unwanted characters


Hello everyone,

I have a large file, well large enough that I don't want to manually comb through it, and need to find any lines that have an invalid character in it.

That valid characters are digits, letters (case insensitive), { , } , and spaces.

I am having trouble writing a reg expr to use with grep to find lines containing anything but those characters.

Any help would be appreciated.

Thanks.
 
Old 10-07-2003, 01:34 PM   #2
SaTaN
Member
 
Registered: Aug 2003
Location: Suprisingly in Heaven
Posts: 223

Rep: Reputation: 33
Code:
 
grep -v -E "^([a-z]|[0-9]|[A-Z]|{|}| |   )+$" file
The last two in the or expression are for spaces and tabs....

If you are in bash then go to visual mode ("CTRL+v") then press tab...

Hope that this is all that you want ....
Feel free to ask me if there is any problem

Welcome to LQ.

Last edited by SaTaN; 10-07-2003 at 01:36 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expressions markjuggles Programming 2 05-05-2005 11:39 AM
Regular Expressions overbored Linux - Software 3 06-24-2004 02:34 PM
help with REGULAR EXPRESSIONS ner Linux - General 23 10-31-2003 11:09 PM
Regular expressions aromes Linux - General 1 10-15-2003 12:29 PM
regular expressions? alaios Linux - General 2 06-11-2003 03:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration