sed not storing output in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed not storing output in shell script
# 1  
Old 03-09-2012
sed not storing output in shell script

Hello,

Following my learning of shell scripting.. I got stuck yet again.
If I execute this command on terminal:

Code:
$ sed "s/off/on/g" file > fileAUX

I successfully change the text off to on from file to fileAUX.

But the same command is not working inside a shell script. I tested and sed does find the file and it DOES make the changes if I direct it to stdoutput (screen)

I tried running with sudo (I am using Ubuntu) with no success..

Any idea?

Last edited by pludi; 03-09-2012 at 06:05 AM..
# 2  
Old 03-09-2012
can you show your script
# 3  
Old 03-13-2012
Hello,

I should have posted a response earlier, thanks itkmara for asking me to show the script. I was only thinking on that line and I did not realise the issue was the working path I was using.

The previous line WORKS in shell terminal and script
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with the shell script after storing the directory in a variable

FTP is connecting to the server but i am getting an error - Enter if the env is dev or test or prod: test Please enter the id no : xxxxxxx Connected to xxxx 220 (vsFTPd 2.2.2) 331 Please specify the password. 230 Login successful. ?Invalid command ?Invalid command ?Invalid command... (3 Replies)
Discussion started by: chandraprakash
3 Replies

2. Shell Programming and Scripting

Storing the Linux command output to an array in perl script

Hi I am trying to store the output of a command into an array in perl script. I am able to store but the problem is i am unable to print the array line with one line space. i mean i inserted the \n in loop ...but not getting the result. I have written like this #!/usr/bin/perl @a =... (2 Replies)
Discussion started by: kumar85shiv
2 Replies

3. Shell Programming and Scripting

Storing filenames in an array in shell script

hi, i am writing a shell script in which i read a line in a variable. FNAME="s1.txt s2.txt s3.txt s4.txt s5.txt" i want to create a array and store single file names in a array.. so the array should contain arr="s1.txt" arr="s2.txt" arr="s3.txt" arr="s4.txt" arr="s5.txt" how to... (3 Replies)
Discussion started by: Little
3 Replies

4. Shell Programming and Scripting

Storing output into a variable

My script below seems to be choking because I need the the output of the find command to be stored as a variable that can then be called by used lower in the script. #!/bin/bash cd "/resumes_to_be_completed" var1=find . -mmin -1 -type f \( -name "*.doc" -o -name "*.docx" \)... (1 Reply)
Discussion started by: binary-ninja
1 Replies

5. Shell Programming and Scripting

Problems with storing oracle sqlplus query output shell script

Hello everyone, I have a RHEL 5 system and have been trying to get a batch of 3-4 scripts each in a separate variables and they are not working as expected. I tried using following syntax which I saw a lot of people on this site use and should really work, though for some reason it doesn't... (3 Replies)
Discussion started by: rockf1bull
3 Replies

6. UNIX for Dummies Questions & Answers

Storing lines of output into a script variable

I'm sure this is a simple thing but I can't figure it out. In a script that I'm writing, I'd like to be able to store each line of output from "ls -l" into a variable. Ultimately I'd like to end up with something like: for a in `ls -l` do something with $a doneBut that's reading each... (2 Replies)
Discussion started by: ewoods
2 Replies

7. Shell Programming and Scripting

Storing the values in text file using while loop in shell script

Hi Frdz while read line do name=`echo $line | cut -d' ' -f 1 ` password=`echo $line | cut -d`-` -f 2` name > logfile.txt password > logfile.txt done < list.txt When it is run, am getting last values in list.txt file only,it is not storing lall the list entry values. How can i... (5 Replies)
Discussion started by: KiranKumarKarre
5 Replies

8. Shell Programming and Scripting

Sed subsitution on loop output in shell script

I have a forloop which checks a log for a set of 6 static IP addresses and each IP found is logged to a file which is then mailed to me. After the forloop I always have a text file that may contain up to 6 IP addresses or may contain 0. What I want to do is substitute the IP addresses (if any)... (2 Replies)
Discussion started by: Moxy
2 Replies

9. UNIX for Dummies Questions & Answers

Storing the output into a variable

Hi unix gurus, I am trying to store the result of a command into a variable. But it is not getting stored. x='hello' y=echo $x | wc -c but it is giving the output as 0(zero) Pls help me its very urgent (7 Replies)
Discussion started by: ravi raj kumar
7 Replies

10. Shell Programming and Scripting

storing output of awk in variable

HI I am trying to store the output of this awk command awk -F, {(if NR==2) print $1} test.sr in a variable when I am trying v= awk -F, {(if NR==2) print $1} test.sr $v = awk -F, {(if NR==2) print $1} test.sr but its not working out . Any suggestions Thanks Arif (3 Replies)
Discussion started by: mab_arif16
3 Replies
Login or Register to Ask a Question