The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find special characters?? sumitc AIX 3 05-04-2008 05:20 PM
Grep with Special Characters Vashj Shell Programming and Scripting 6 11-27-2007 03:51 AM
how to see special characters in a file using vi jingi1234 UNIX for Dummies Questions & Answers 6 10-19-2005 08:57 AM
special characters nawnaw UNIX for Dummies Questions & Answers 2 05-18-2004 12:17 PM
awk/sed with special characters apalex Shell Programming and Scripting 5 05-06-2002 01:40 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2008
Registered User
 

Join Date: Feb 2008
Posts: 5
unescaping special characters

how do i unescape special characters in Unix.

Suppose i've a file named -xyz.txt, how do I remove the file.
Ofcourse Icant give rm -xyz.txt thats not gonna work.
We can go in regular expression like this ls | grep -e '-'xyz.txt | rm; but I'd like to know any simpler way than this.

Thanks for the guys posting in their suggestions.
Reply With Quote
Forum Sponsor
  #2  
Old 02-06-2008
Tytalus's Avatar
Registered User
 

Join Date: Jun 2003
Location: Scotland
Posts: 290
for the case where you want ro remove a file beginning with a -, e.g -xyz you can do

Code:
rm -- -xyz
the -- (double hyphen) indicates that the following args are not to be interpreted as options but should be taken literally.

HTH
Reply With Quote
  #3  
Old 02-06-2008
Tytalus's Avatar
Registered User
 

Join Date: Jun 2003
Location: Scotland
Posts: 290
And just to make it clear - that is not a space between the dashes... copy/paste it to see the format clearly
Reply With Quote
  #4  
Old 02-06-2008
Registered User
 

Join Date: Jan 2008
Location: London e Milano
Posts: 71
Escaping special characters (at least in SED), is the foward slash key '\''

e.g. http://
=
http\:\/\/website.com\/
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0