The UNIX and Linux Forums  

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



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed with special characters itzz.me Shell Programming and Scripting 4 04-06-2009 10:34 PM
Grep not working - special characters?? gugs Shell Programming and Scripting 3 07-31-2008 12:22 PM
get rid of special characters vakharia Mahesh UNIX and Linux Applications 4 07-29-2008 02:36 PM
grep with special characters guruparan18 UNIX Desktop for Dummies Questions & Answers 3 06-12-2008 06:58 AM
Grep with Special Characters Vashj Shell Programming and Scripting 6 11-27-2007 06:51 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-18-2009
daveaasmith daveaasmith is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 13
Using GREP for special characters

Hi folks

I am issuing the following command:

grep "[\/:*?"<>|#+%&]" *

Looking for the characters \/:*?"<>|#+%& within all files in a directory, but the command fails being unhappy with pipe:

ksh: 0403-057 Syntax error: `|' is not expected.

How do I force the command to take the pipe | ? I guess the same is for *some* of the other symbols.

Regards, Dave
  #2 (permalink)  
Old 06-18-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,972
The shell knows 3 kinds of quotes:
  • 'Single Quotes': Use that string as is, no parameter substitution, no globbing, ...
  • "Double Quotes": Use that string as is, after parameter expansion
  • `Backticks`: Use the output of the command between the backticks
So if you change you double to single quotes, it should run fine.
  #3 (permalink)  
Old 06-18-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,559

Code:
grep "[[:punct:]]"

Reply

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 05:54 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