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
Replace a perticular character of all lines of a file abovais Shell Programming and Scripting 1 12-11-2007 05:35 AM
to replace one character by numbers in a file cdfd123 Shell Programming and Scripting 7 10-07-2007 11:25 PM
How to replace a character in a file preethgideon Shell Programming and Scripting 6 08-30-2006 07:19 PM
How would you replace the n character in a file with some xyz? JosephGerard UNIX for Dummies Questions & Answers 2 07-21-2005 09:46 AM
How would I replace the 9th character of every line in a file? LordJezo Shell Programming and Scripting 5 09-01-2004 12:51 PM

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 06-04-2008
ntgobinath ntgobinath is offline
Registered User
  
 

Join Date: May 2008
Posts: 38
How to replace a character in the file?

Hi All,

I have file contains the following information.

chem00s4.mis.amat.com[ 0 [ 81 ] ] Critical 3/21
chem00s4.mis.amat.com[ 0 [ 82 ] ] Normal 3/22
chem00s4.mis.amat.com[ 0 [ 83 ] ] Normal 3/23
chem00s4.mis.amat.com[ 0 [ 84 ] ] Normal 3/24
chem00s4.mis.amat.com[ 0 [ 85 ] ] Critical 3/25
chem00s4.mis.amat.com[ 0 [ 86 ] ] Normal 3/26
chem00s4.mis.amat.com[ 0 [ 87 ] ] Critical 3/27
chem00s4.mis.amat.com[ 0 [ 88 ] ] Normal 3/28
chem00s4.mis.amat.com[ 0 [ 89 ] ] Normal 3/29
chem00s4.mis.amat.com[ 0 [ 90 ] ] Normal 3/30


I want to replace all '/' to '\'. How to do this?

Thanks in Advance,
Gobinathan.S
  #2 (permalink)  
Old 06-04-2008
Franklin52 Franklin52 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,344
Try this:


Code:
sed 's!/!\\!' file

Regards
  #3 (permalink)  
Old 06-04-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,926
With tr:


Code:
<file tr / '\\'

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 08: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