03-26-2008
sed changes go to standard out....?
Hi gang: Need some help with "sed". The script below is working except for the sed command. It does replace the words I'm searching for but the change goes to standard out (screen) so the file is not updated. How do I get sed to modify the file?? I'm sure it something simple...
Thanks All !!! This is running Solaris 8
#! /bin/sh
# Begin shell script to modify the netmap
echo "Welcome to the netmap edit tool"
echo "What would you like to do?"
echo 1. Add a node to the netmap
echo 2. Modify a node in the netmap
echo 3. Delete a node in the netmap.
read choice
# Begin choice determination logic
if [ $choice = 1 ]
then
# logic to add a new node to current netmap
cat newnode >> netmap.cfg
# New Node info collection
echo " Enter the new node name"
read newnodename
sed "s/bogus/$newnodename/" netmap.cfg
echo "Enter IP address of new node"
read IP
sed "s/ipaddress/$IP/" netmap.cfg
else
echo "Still under construction"
fi
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I wanted study and write a unix like system. who can help me.
-------------
Removed the garbled characters... not sure why they were there... (2 Replies)
Discussion started by: crashsky
2 Replies
2. HP-UX
I am a bit confused about the use of _v2 standard libraries on HP. I am working on HP11.11 risk machine and HP 11.23 Itanium machine.
I am building a C++ shared library which is linked by a JNI shared library and other non-java related libraries. Eveything is compiled with -AA flag. When I... (0 Replies)
Discussion started by: cactuar
0 Replies
3. UNIX for Advanced & Expert Users
Dear all,
I have a need to find the standard of my system such as POSIX.
How can I know that. Is there any way to find it.
I am using GNU/Linux. (2 Replies)
Discussion started by: nagalenoj
2 Replies
4. Shell Programming and Scripting
I have an xml file.
I am doing some change, say deleting line 770. File name is file.xml. I use:
sed '770d' file.xml
but this does not actually make changes in the *file* but shows the changes on standard output (screen)
if i use
$var=`sed '770d' file.xml`
echo $var > file.xml
this... (3 Replies)
Discussion started by: indianjassi
3 Replies
5. Shell Programming and Scripting
Hi there
how can i get the result of a command to not give me its error. For example, on certain systems the 'zfs' command below is not available, but this is fine becaues I am testing against $? so i dont want to see the message " command not found" Ive tried outputting to /dev/null 2>&1 to no... (5 Replies)
Discussion started by: hcclnoodles
5 Replies
6. Solaris
Please give me any example for standard input in Solaris. (6 Replies)
Discussion started by: karman0931
6 Replies
7. UNIX for Dummies Questions & Answers
Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway?
Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies
8. Shell Programming and Scripting
I need to run a cronjob and in the cronjob I execute a script that if there is an error produces standard error so I do
/RUNMYSCRIPT 2> mylogfile.log
However, if it runs correctly, I don't get a standard error output, I get a standard out output. How do I redirect both standard error and... (2 Replies)
Discussion started by: guessingo
2 Replies
9. Shell Programming and Scripting
Hi all .... vexing problem here ...
I am using sed to replace some special characters in a .txt file:
sed -e 's/_<ED>_/_355_/g;s/_<F3>_/_363_/g;s/_<E1>_/_341_/g' filename.txt
This command replaces <ED> with í , <F3> with ó and <E1> with á.
When I run the command to standard output, it works... (1 Reply)
Discussion started by: crumplecrap
1 Replies
10. Shell Programming and Scripting
I am trying use sed to replace a string in a file with input string passed, but it is not replacing the string. instead it replace as $1. Please find below the code.
echo $1
sed -i.$now "s/http.*.myservice.*.war/$1/" tempfile.xml
I am running above code as below
myscript.sh ReplaceString... (4 Replies)
Discussion started by: sakthi.99it
4 Replies