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
Piping in UNIX simo007 UNIX for Dummies Questions & Answers 3 05-23-2007 03:40 AM
Help with piping program PuppyHusher High Level Programming 3 03-30-2007 01:26 PM
piping lnatz Shell Programming and Scripting 1 07-14-2006 03:30 AM
Help (Piping ls, tr, cut) scan Shell Programming and Scripting 2 02-11-2006 08:40 AM
Tar and gunzip piping madyodacolon Shell Programming and Scripting 2 05-11-2004 11:27 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-11-2007
mph mph is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 58
Piping to ex from a script

Is anyone piping commands to ex from scripts?

I.E.
Code:
echo '%s/change this/to that/\nwq' | ex file.name

I've been using it for years with AIX, Solaris, SGI, with variations ksh and Mandriva and others with pdksh. I've just started using CentOS with ksh and it no longer works. I've tried single quotes double, etc... I've also tried using other shells to no avail. zsh does work, but I don't know how compatible the rest of my scripting would be with it.

I know that Mandriva uses pdksh and CentOS is using AT&T korn shell. I know that there are differences between the two, such as returning variables from subroutines, etc...

I use this type of file manipulation a lot. It's very convenient to be able to change a file without having to create an intermediate file like you would with sed.

Any ideas on why something this simple won't work with AT&T's ksh, or what I need to do to get it working? Or, should I just give in and switch to zsh for the scripts that use ex?

Thanks in Advance.
  #2 (permalink)  
Old 10-11-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
printf '%cs/change this/to that/\nwq' '%' | ex file.name

  #3 (permalink)  
Old 10-11-2007
mph mph is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 58
If only all of life were that easy

I guess I was looking so hard at the format of the echo statement, I didn't see that it could have been the problem!!! As I read that I heard a very loud "POP" I think it might of been my head coming out of my tail...

But Like I always say... "I'd rather have a bottle in front of me than a frontal lobotomy!"

Thanks a bunch.

P.S. The printf didn't work. echo -e did.

Last edited by mph; 10-12-2007 at 10:43 AM.. Reason: update
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 06:42 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