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 > 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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing a character using sed Raynon Shell Programming and Scripting 6 11-21-2008 11:24 AM
read a variable character by character, substitute characters with something else vipervenom25 UNIX for Dummies Questions & Answers 2 06-06-2008 04:18 PM
Removing '." character using SED arvindcgi Shell Programming and Scripting 2 06-03-2008 08:28 AM
removing new line character ammu Shell Programming and Scripting 2 01-15-2008 10:12 AM
Removing the ^M character in VI julesinbath UNIX for Dummies Questions & Answers 2 04-29-2002 10:13 AM

Closed Thread
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 04-19-2008
sertansenturk sertansenturk is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 2
Removing character ' from a variable

Hello there,

I have a variable in the form of '/example/file.txt' . I want to remove the ' characters from the beginning and the end so that the my new variable becomes /example/file.txt . How can I do it in a script?

I know this is a fairly easy question, but i wasn't able to implement it.
  #2 (permalink)  
Old 04-19-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,309
You can use tr, read the man page.

Regards
  #3 (permalink)  
Old 04-19-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,953
or

search the forums

am sure there are multiple threads about the same topic or related to that

using sed to search and replace the character(s)

in your case its going to be searching " ' " and replacing with ""
  #4 (permalink)  
Old 04-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
test example - note that you have to "escape" the ' character or the shell eats it, so to speak. \ = "escape" character
Code:
echo \'hello\'
echo \'hello\'  | tr -d \'
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 01:00 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