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
How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..? laknar AIX 3 07-16-2009 05:35 AM
current CPU usage, memory usage, disk I/O oid(snmp) S_venkatesh SUN Solaris 2 12-13-2008 06:19 AM
how can I find cpu usage memory usage swap usage and logical volume usage alert0919 HP-UX 3 12-02-2008 02:38 PM
CPU usage and memory usage mansoorulhaq High Level Programming 1 08-09-2007 04:55 PM
Monitor CPU usage and Memory Usage Gajanad Bihani High Level Programming 2 03-09-2005 07:35 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 4 Weeks Ago
proactiveaditya proactiveaditya is offline
Registered User
  
 

Join Date: Sep 2009
Location: Kolkata,India
Posts: 132
Sed usage

How can i use sed to change "Linux Cpu (EDF).sh" to "LinuxCpuEDF.sh"?
I want to replace the spaces and brackets.
  #2 (permalink)  
Old 4 Weeks Ago
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,300
Quote:
Originally Posted by proactiveaditya View Post
How can i use sed to change "Linux Cpu (EDF).sh" to "LinuxCpuEDF.sh"?
I want to replace the spaces and brackets.
Try this:
Code:
sed 's/[ ()]//g'
  #3 (permalink)  
Old 4 Weeks Ago
proactiveaditya proactiveaditya is offline
Registered User
  
 

Join Date: Sep 2009
Location: Kolkata,India
Posts: 132
Thanks, it worked.
But i want to change the value of the string permanently.
  #4 (permalink)  
Old 4 Weeks Ago
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,300
Quote:
Originally Posted by proactiveaditya View Post
Thanks, it worked.
But i want to change the value of the string permanently.
Assuming you want to change the value of the variable:

Code:
string="Linux Cpu (EDF).sh" 
string=$(echo "$string" | sed 's/[ ()]//g')
Assuming the variable is a file and you want to rename the file:

Code:
string="Linux Cpu (EDF).sh" 
mv $string $(echo "$string" | sed 's/[ ()]//g')
  #5 (permalink)  
Old 4 Weeks Ago
panyam panyam is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2008
Posts: 474
something like this :
Code:
str="Linux Cpu (EDF).sh"

str=`echo $str | sed 's/[ ()]//g'`

echo $str
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 12:03 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