Sponsored Content
Full Discussion: Piping to ex from a script
Top Forums Shell Programming and Scripting Piping to ex from a script Post 302140255 by mph on Thursday 11th of October 2007 01:46:54 PM
Old 10-11-2007
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.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

redirecting/piping

i want to fully undertand redirecting/piping. i know most of the basic stuff, like ls|less or cat file|grep hello etc etc. but there are a somethings like find / -name file 2>/dev/null. what's is the 2? i know it redirects the errors (at least Permission denied ones) to /dev/null (the unix... (3 Replies)
Discussion started by: crashnburn
3 Replies

2. Shell Programming and Scripting

piping

I am using pipes (specifically piping out) in Perl to put an array from one file into an array in a different file. I can't figure out how to transfer the array. I kow how to open the pipe : open (FILEHANDLE, "| file") or die~ but how do I transfer the array. I think it has something to do with... (1 Reply)
Discussion started by: lnatz
1 Replies

3. Shell Programming and Scripting

Piping / Executing

I've got a file with lots of commands I want to run in it. They're formatted like so: cp /path/to/file /path/to/new/file and on and on and on. Hundreds of them. Anyways, I'd like to execute them one at a time, then check what time it is, and repeat this process until 7am. I can... (3 Replies)
Discussion started by: ProFiction
3 Replies

4. Shell Programming and Scripting

KSH script: piping passes command-line arguments

Dear forum I have the following small script: #!/bin/ksh echo -e "abba-o" | awk -F '-' '{ print $2 }' | cut -b 1It needs to be ksh.. in bash I don't have this problem. If I run this on opensuse 10.2 I get this as output: e If I run this on suse enterprise 10 sp2 then I get this: o ... (1 Reply)
Discussion started by: gemtry
1 Replies

5. Shell Programming and Scripting

problem piping input to script with echo

I am trying to have a script run without interaction from the command line. So in my script i have a line like this echo -e "\n\n\ny\ny\n" | ./script the goal being the ability to mimic 3 Enter presses and 2 'y/n' responses with 'y' followed by enter. For some reason tho, it is not... (1 Reply)
Discussion started by: mcdef
1 Replies

6. Shell Programming and Scripting

Piping output from a command into bash script

Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running echo 'test' | sms-autosend-backup.sh ... (2 Replies)
Discussion started by: akindo
2 Replies

7. Shell Programming and Scripting

Exit code from piping in unix shell script

Hi , I have following code in my shell script : "$TS_BIN/tranfrmr" "${TS_SETTINGS}/tranfrmr_p1.stx" "${TS_LOGS}/tranfrmr_p1.err" | ( "$TS_BIN/cusparse" "${TS_SETTINGS}/cusparse_p2.stx" "${TS_LOGS}/cusparse_p2.err" | ( "$TS_BIN/tsqsort" "${TS_SETTINGS}/srtforpm_p3.stx"... (8 Replies)
Discussion started by: sonu_pal
8 Replies

8. Shell Programming and Scripting

Piping to a python script

Hello, I have a python script (not created by me), let's call it myscript, which I call with several parameters. If I don't provide the --password parameter, the script will ask the user to input the password. So I run the script like this: /wherever/myscript --username=whoever... (3 Replies)
Discussion started by: gplayersv
3 Replies

9. UNIX for Dummies Questions & Answers

Piping commands

Hi I am tryin to undertand piping command1|command2 from what i learn output of cammand 2 is an intput for command 1 right? If so . What dose next sequence do cat f1 >> f2 | grep '^' I think it takes context of f1 and Concatenate's it to f2 and then looks for ....i don't know..... (7 Replies)
Discussion started by: iliya24
7 Replies

10. Shell Programming and Scripting

Piping the "script" command through the logger command.

I use the snippet below in /etc/profile on RHEL Linux to capture command line logging and it all works well and good. Now I'd like to pipe the same output from script through the logger command so it all gets logged to syslog. The only additional code I've added is in bold below (|... (4 Replies)
Discussion started by: woodson2
4 Replies
NAUTILUS-SCRIPTS-MANAGER(1)				      General Commands Manual				       NAUTILUS-SCRIPTS-MANAGER(1)

NAME
nautilus-scripts-manager - easy tool for nautilus scripts management SYNOPSIS
nautilus-scripts-manager [options] DESCRIPTION
This manual page documents briefly the nautilus-scripts-manager command. nautilus-scripts-manager is a program that allows any user to easily manage installed Nautilus scripts. GENERAL OPTIONS
-h, --help Show summary of options. -v, --version Show version of program. COMMANDS
One (and only one) of the following commands can be passed: -e, --enable=ENABLE Enable script ENABLE. -d, --disable=DISABLE Disable script DISABLE. -l, --list-enabled List enabled scripts. -a, --list-available List available scripts. If no command is provided, the graphical interface is started. OPTIONS
-e, --position=POSITION In conjunction with -e or -d: establish the position of the script (can be just a name, or a path with slashes - quote it if it con- tains spaces). SEE ALSO
nautilus(1), AUTHOR
nautilus-scripts-manager and this manual page were written by Pietro Battiston <me@pietrobattiston.it>. This manual page was written for the Debian project (but may be used by others). July 14, 2009 NAUTILUS-SCRIPTS-MANAGER(1)
All times are GMT -4. The time now is 03:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy