The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > SUN Solaris
Google UNIX.COM


SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Query related to scp command sureshg_sampat Shell Programming and Scripting 2 12-03-2007 02:59 AM
rsh and sql query sars Shell Programming and Scripting 1 02-21-2007 04:50 AM
query on grep command collins UNIX for Dummies Questions & Answers 4 06-21-2006 03:35 PM
query varadakumar UNIX for Advanced & Expert Users 1 04-11-2002 09:09 AM
FTP query csong2 UNIX for Advanced & Expert Users 1 11-29-2001 01:50 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-13-2008
Registered User
 

Join Date: Jun 2008
Posts: 2
Smile query on sed command

I have done a script using sed which replaces a string in file.
I face 2 problems, while using sed command.

1)last line of the file is missing.
2)if i am are using wild card character in the command, Its not taking the next matching pattern ie if I am giving the pattern abc*def to be replaced with abcXdef : and the input file contains:-

abctttttttttttdefmmmmmmmmmabcttttttttttdef

the o/p i am expecting is abcXdefmmmmmmmmmabcXdef

but the o/p I am getting is abcXdef.


the first problem is getting solved when i put an enter in the last line in the file. But i am having pratical difficulty that Its ahecking almost 600files.


My script code is giving below

script.sh
.................................

#!/bin/sh

find /opt/users/adm5tca1/simulator/OSDI/OSDISimulator/jakarta-tomcat-5.0.28/webapps/OSDI_SIM/WEB-INF/classes/workarea/ -name 'ResponseBody.txt' 2>/dev/null > pathy.txt
FILE_NAME=pathy.txt

while read a_line ; do

echo $a_line
/usr/bin/sed -e 's!<ns6\:originatingOrderLines><ns6\:item>.*<\/ns6\:item><\/ns6\:originatingOrderLines>!<ns6\:originatingOrderLines><ns6\:item>DEFAULT<\/ns6\:item><\/ns6\:originatingOrderLines>!g' $a_line > bb.txt
mv bb.txt $a_line


done < $FILE_NAME

.................................................

Can anyone plz help me in solving out.

Last edited by vino; 06-13-2008 at 12:40 AM. Reason: disabled smilies
Reply With Quote
Forum Sponsor
  #2  
Old 06-13-2008
Registered User
 

Join Date: Jun 2008
Location: Scotland
Posts: 121
This query is a duplicate of http://www.unix.com/shell-programmin...#post302204979

Last edited by spirtle; 06-13-2008 at 02:05 AM. Reason: duplicate
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:51 AM.


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

Content Relevant URLs by vBSEO 3.2.0