Not Legal Characters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not Legal Characters
# 1  
Old 08-24-2005
Not Legal Characters

I have a file that I want to grep and identify all of the illegal characters. I have a list of legal ascii characters

\11\12\40-\176,\0-\255

so i try a grep -v to exclude these but my syntax is not correct??

$ cat TRANS_20050613_00.DAT.ERROR | grep -v '\11\12\40-\176\0-\255'
grep: RE error 25: ``\digit'' out of range.


Can any one help?
# 2  
Old 08-25-2005
Grepping illegal characters

Hi,
the list can be 'a\|b\c|1\|2'

so u should use the OR (|) flag in the grep, to dereference | u need \.
U can use the grep -v 'list'

-Balaji.S
# 3  
Old 08-25-2005
for a set of characters you need to use []
so you want something like:

LANG=C grep -Ev "[ -~]"

note a literal tab and a space are the first 2 of the 4 chars within []
To type a literal tab (in vi/shell) do Ctrl+v tab
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Legal and illegal bash variable names?

list of legal and illegal bash variable names and wht each is either illegal and ligal? 4. Seneca college, Toronto , Canada, peter wheeler, tech 154: (5 Replies)
Discussion started by: renegade755
5 Replies

2. Programming

Array[count+1] legal?

I get weird decimal digits when I run the program below. int coe_amount; cout << "How many coefficients exist in your term? "; cin >> coe_amount; float coefficient; for (int count = 0; count < coe_amount; count ++) { ... (4 Replies)
Discussion started by: DyslexicChciken
4 Replies

3. Shell Programming and Scripting

[CSH]legal to declare a variable like this

I am trying to declare a variable like this #!/bin/csh -f set c_arg = $a $b $c However, since i need it to declare before declaring $a ,$b or $c. As of now i am getting an error which says $a not defined. Is it possible to define a variable c_arg w/o interpreting the values $a $b $c (2 Replies)
Discussion started by: animesharma
2 Replies

4. AIX

Legal Disclaimer setup in CDE

Hi pals I manage nearly 200+ aix workstations. I need to setup a legal disclaimer in all the workstations. When the user do a interactive login in CDE the legal disclaimer should be displayed and once he accepts the same he should be able to login to system. Can anybody suggest me as to... (0 Replies)
Discussion started by: sriram.s
0 Replies

5. Programming

Is this a legal close-on-exec-move?

In another part of the program, a file is opened using fopen(). Anyhow, I was wondering if using dup2() in the following snippet was a legal close-on-exec move. static int tel(char *user, char *tty, const char *what) { pid_t cpid, wpid; int stats; cpid = fork(); if... (9 Replies)
Discussion started by: frequency8
9 Replies

6. Programming

legal code?

hi friends, the following code works fine,but the question is "is this a valid c". i really have no idea....... void func() { int x = 50; { int y; y = x + 400; printf("x = %d\n",x); printf("y = %d\n",y); } } (2 Replies)
Discussion started by: mxms755
2 Replies
Login or Register to Ask a Question