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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find and replace string in a directory files koti_rama Shell Programming and Scripting 2 05-30-2008 12:48 AM
shell script to find and replace string in multiple files pharos467 Shell Programming and Scripting 10 05-20-2008 08:39 AM
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 2 04-11-2008 11:32 AM
Find and replace a string in multiple files pharos467 UNIX for Dummies Questions & Answers 2 11-05-2007 07:47 PM
Need to replace a string in 100's of files calredd Shell Programming and Scripting 3 03-21-2007 01:14 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-01-2008
Registered User
 

Join Date: Aug 2007
Posts: 40
Stumble this Post!
Replace a string containing :/=\ in files

I have read many forums about replacing a string in file.
I tested but it doesn't work with my string

For example I want to replace =x=ks24Y\:LOP= with h\P6qwx:aUE/.

Thank you
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-01-2008
radoulov's Avatar
addict
 

Join Date: Jan 2007
Location: Milan, Italy/Varna, Bulgaria
Posts: 1,521
Stumble this Post!
Code:
$ printf ">>> %s <<<\n" '=x=ks24Y\:LOP='|sed 's =x=ks24Y\\\:LOP= h\\\P6qwx:aUE/ '
>>> h\P6qwx:aUE/ <<<
Reply With Quote
  #3 (permalink)  
Old 08-14-2008
Registered User
 

Join Date: Aug 2008
Posts: 3
Stumble this Post!
Hi,

I want to replace a srting '; with ABCD'; in a file from line 1 to line 65. Is there any single command to do it without using awk
Reply With Quote
  #4 (permalink)  
Old 08-14-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,631
Stumble this Post!
What's wrong with awk? Did you try the solutions posted above?

Code:
sed "1,65s/';/ABCD';/" file >newfile
Also, please start a new thread instead of hijacking an old thread unless your question is a direct follow-up.
Reply With Quote
  #5 (permalink)  
Old 08-14-2008
Registered User
 

Join Date: Aug 2008
Posts: 3
Stumble this Post!
Thanks era
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0