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 double quotes in a file kingofprussia UNIX for Dummies Questions & Answers 3 12-19-2008 05:28 AM
String concat that keeps quotes duke UNIX for Dummies Questions & Answers 8 07-24-2008 06:48 AM
Add single quotes in string mrjunsy UNIX for Dummies Questions & Answers 1 07-18-2008 10:09 AM
sed removing comma inside double quotes joanneho Shell Programming and Scripting 2 06-30-2008 12:13 AM
problem with single quotes in a string and findbug bob122480 Shell Programming and Scripting 9 01-19-2007 11:38 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-24-2009
aplaydoc aplaydoc is offline
Registered User
  
 

Join Date: Feb 2009
Location: Montreal, Canada
Posts: 10
Removing back quotes from string in CSH

Hello,
I am using csh to read a text file and save its words into variable $word in a foreach loop. These words have small back quotes ` as integral parts of them, for example, one word would be `abc`, another would be `xyz1` etc... These quotes are always the first and last characters of the variable $word. I need to remove these symbols and just keep abc or xyz1.


I tried this code in my csh:
set SortedID = $word
set SortedID = `echo $word | cut -d '`' -f 2`

Obviously it fails because of bad nested use of `, I should probably use an escape character in my '`', but changing it to '\`' did not work. In both cases, with or without the back slash, I get the error:

Unmatched '.

This same code does exactly what I want directly on the Linux shell, since I don't need the back cote to invoque it as I do from csh. Is there another escape character I can use? or maybe there is a different solution all together? Thanks

Last edited by aplaydoc; 02-24-2009 at 05:39 PM..
 

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:17 PM.


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