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
syntax problem grepping? dsimpg1 Shell Programming and Scripting 9 07-17-2007 08:48 PM
Syntax problem with Unix ftp get command mheinen HP-UX 2 02-09-2007 01:01 PM
syntax problem rajan_ka1 Shell Programming and Scripting 3 03-16-2006 10:13 AM
syntax problem rajan_ka1 Shell Programming and Scripting 3 03-08-2006 01:04 PM
multiple cuts syntax problem Gerry405 UNIX for Dummies Questions & Answers 12 10-31-2005 09:23 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 10-16-2007
SanjayLinux SanjayLinux is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 58
Wink Help for Sed Syntax problem

I have one File named "txt_file"
# cat txt_file
<DBType>RT</DBType>
<AppType>RT</AppType>
--------------------------------------------------

I want replace "<AppType>RT</AppType>" to
<AppType>XY</AppType> in txt_file and output redirect to Newfile

--------------------------------------------
I have a scipt file named "add.sh"

#cat add.sh
#!/bin/bash
cat txt_file |sed 's'/<AppType>RT</AppType>'/'<AppType>XY</AppType>/'g' >Newfile
___________________________________________

But when I am running that script(add.sh) I am getting error

"add.sh: line 2: AppType: No such file or directory"

It might be syntax problem.

Coul you please help me out.

Thanks in advance!!

Sanjay
  #2 (permalink)  
Old 10-16-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Quote:
Originally Posted by SanjayLinux View Post
I have one File named "txt_file"
# cat txt_file
<DBType>RT</DBType>
<AppType>RT</AppType>
--------------------------------------------------

I want replace "<AppType>RT</AppType>" to
<AppType>XY</AppType> in txt_file and output redirect to Newfile

--------------------------------------------
I have a scipt file named "add.sh"

#cat add.sh
#!/bin/bash
cat txt_file |sed 's'/<AppType>RT</AppType>'/'<AppType>XY</AppType>/'g' >Newfile
___________________________________________

But when I am running that script(add.sh) I am getting error

"add.sh: line 2: AppType: No such file or directory"
Code:
sed -e "s+<AppType>RT</AppType>+<AppType>XY</AppType>+g" txt_file >Newfile
  #3 (permalink)  
Old 10-16-2007
SanjayLinux SanjayLinux is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 58
Thanks

Perfect Vino Brother !!!
Thanks

~~Sanjay~~
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 11:29 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