![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with grep and regex | raichlea | UNIX for Dummies Questions & Answers | 14 | 04-16-2008 08:25 AM |
| grep with Regex help! | mvalonso | UNIX for Dummies Questions & Answers | 3 | 06-01-2007 12:36 PM |
| Problem with grep Regex Error | lweegp | Shell Programming and Scripting | 6 | 11-16-2006 01:04 AM |
| grep regex problem | iceman | Shell Programming and Scripting | 2 | 02-06-2005 09:44 AM |
| use of regex on grep | solea | UNIX for Dummies Questions & Answers | 0 | 09-30-2004 08:13 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
doubt regardin regex in grep
shudnt this command :
grep [^C] test give all the lines which do not hv 'C'. ^ wrks as negating character inside square brackets right ??? bt in my case grep is printin all the line in the file also wht does grep c+ test & grep c? test shud do ??? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Well, I dont know what exactly [^C] will do, but just ^C matches all lines that start with an upper case 'C'.
|
|
#3
|
||||
|
||||
|
Looks like a homework assignment.
|
|
#4
|
|||
|
|||
|
I know this is an old question, but here's an old answer to match. (It's old because I'm sure the grep command hasn't changed).
[^C] matches any character that's NOT a C. You might want $ grep -E "^[^C]*$" test or more likely, you want $ grep -vE "[C]" test |
|
#5
|
||||
|
||||
|
||||
| Google The UNIX and Linux Forums |