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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
KSH - Character Replacement mixxamike Shell Programming and Scripting 2 09-24-2007 04:43 PM
Character replacement piooooter Shell Programming and Scripting 2 09-06-2007 03:48 AM
convert special character like £ cynnie Shell Programming and Scripting 1 08-08-2007 07:37 AM
Help needed in character replacement in Korn Shell stevefox Shell Programming and Scripting 8 03-30-2007 12:59 AM
special character ? mile1982 High Level Programming 1 10-19-2004 09:15 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 05-22-2008
usshell usshell is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 6
Sed-Special character replacement

Hi

I want to replace ./testsed.ksh
with
testsed.ksh

./ is to be removed

scriptnm=`sed -e 's/\.///' $0

does not work

Please help
  #2 (permalink)  
Old 05-22-2008
elthox elthox is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 30
Quote:
Originally Posted by usshell View Post
Hi

I want to replace ./testsed.ksh
with
testsed.ksh

./ is to be removed

scriptnm=`sed -e 's/\.///' $0

does not work

Please help
sed -e 's/\.\///g' $0
  #3 (permalink)  
Old 05-22-2008
penchal_boddu penchal_boddu is offline
Registered User
  
 

Join Date: Apr 2008
Location: Bangalore
Posts: 127
Hi

using sed

echo './testsed.ksh' | sed 's#\./##'

using awk

echo './testsed.ksh' | awk -F"/" '{print $NF}'

one more

basename ./testsed.ksh

Thanks
Penchal
  #4 (permalink)  
Old 05-22-2008
aju_kup aju_kup is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 189

Code:
$ echo $var
./testsed.ksh
$ echo $var | sed 's:^\./::'
testsed.ksh
$

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 12:06 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