The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Homework & Coursework Questions
.
google unix.com



Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed pattern matching ravi_rn Shell Programming and Scripting 4 04-20-2009 07:24 AM
Pattern matching New to Sed & Awk pg55 UNIX for Dummies Questions & Answers 0 04-16-2009 06:58 PM
counting the lines matching a pattern, in between two pattern, and generate a tab d.chauliac Shell Programming and Scripting 4 03-19-2009 01:30 PM
comment/delete a particular pattern starting from second line of the matching pattern imas Shell Programming and Scripting 4 10-13-2008 02:37 AM
pattern matching larryase UNIX for Dummies Questions & Answers 3 11-22-2004 06:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 3 Weeks Ago
aadi_uni aadi_uni is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 15
Pattern matching

Use and complete the template provided. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data: How do you locate all nonblank lines that don't begin with #, /*, or //


2. Relevant commands, code, scripts, algorithms:
grep and regular expressions



3. The attempts at a solution (include all code and scripts):
grep ^[^ # \/* \//] file


4. School (University) and Course Number:
UB CS 615
  #2 (permalink)  
Old 3 Weeks Ago
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,568
For a start, remove the spaces in brakets:
Code:
ant:/home/vbe $ grep ^[^ # \/* \//] greptest
grep: [] imbalance.
ant:/home/vbe $ more greptest
1. The problem statement, all variables and given/known data: How do you locate 
all 
nonblank lines that don't begin with #, /*, or //
#  1
/* 2
// 3
Ha *
plpl *
*  a
/  b
/# c
ant:/home/vbe $ grep ^[^#\/*\//] greptest
1. The problem statement, all variables and given/known data: How do you locate all 
nonblank lines that don't begin with #, /*, or //
Ha *
plpl *
  #3 (permalink)  
Old 3 Weeks Ago
aadi_uni aadi_uni is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 15
I am not getting you exactly..removing spaces ..
I want exact solution..if u can help me..thanks..
  #4 (permalink)  
Old 3 Weeks Ago
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,568
Did you look at my screen hard copy? and the difference at execution of the 1rst attempt -1rst line and second (spaces removed...)?
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:23 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0