06-11-2008
Your VALUE is using backticks instead of single quote characters.
Could that be the issue?
d really should work unless there was a pound sign in your ${oldDate} or ${newDate} variables.
Some more precise sample code may be helpful here.
-mschwage
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
So what I'm trying to do is
I have these variables and if they have a dot in them , I want everyting before and including the dot removed.
Any ideas ?
Something like this I would want :
$var = $var | sed 's/.*\.//'
but that does't work.
I want to save that removal $var... (2 Replies)
Discussion started by: seaten
2 Replies
2. Shell Programming and Scripting
HOw can I use any variable in sed command.
For example I am using 'sed -e 's/?/$ORACLE_HOME/g' $file_name
Here it replaces ? with $ORACLE_HOME. Instead of it I need actual value of $ORACLE_HOME. How can I do that?
Please advice.
Thanks in advance.
Malay (13 Replies)
Discussion started by: malaymaru
13 Replies
3. Shell Programming and Scripting
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Discussion started by: alrinno
2 Replies
4. Shell Programming and Scripting
i need to use a value in the Variable to print a particular line from a file using sed command.
i tried the below one but its is not working
sed -n ' "$var"p ' abc.txt
but its is not working please help me to sort out this. (3 Replies)
Discussion started by: Kochu77
3 Replies
5. Shell Programming and Scripting
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies
6. Shell Programming and Scripting
I'm trying to make a sed substitution where the substitution pattern is an environment variable to be expanded, but the variable contains a "slash".
sed -e 's/<HOME_DIRECTORY>/'$HOME'/'This gives me the following error:
sed: -e expression #1, char 21: unknown option to `s'Obviously this is... (2 Replies)
Discussion started by: Ilja
2 Replies
7. Shell Programming and Scripting
Hi Friends
in sed whether we can use variable.like the following expression.
sed -i 's/ABC/$var/g' filename
I am using Kernel 2.6.18-194.11.1.el5 RedHat linux.
I have tried sed -i 's/ABC/"$var"/g' filename, still not working.:(
Please help.
Thanks in advance
Joy (2 Replies)
Discussion started by: itsjoy2u
2 Replies
8. Shell Programming and Scripting
Hello
i would like to interpret a variable in this command
cnt=3
sed -n '${cnt}p' file.txt
sed: 0602-403 `${cnt}`p is not a recognized function.
can you help me please ?
thanks (2 Replies)
Discussion started by: ade05fr
2 Replies
9. Red Hat
Hi all,
Hereby wish to have your advise for below:
Main concept is
I intend to get current directory of my script file.
This script file will be copied to /etc/init.d.
A string in this copy will be replaced with current directory value.
Below is original script file:
... (6 Replies)
Discussion started by: cielle
6 Replies
10. Shell Programming and Scripting
version=git
release=r8
echo lp-testsuite-git-r8.x86_64.rpm |sed -e "s/-$version-$release.*//g"
I want to get
lp-testsuite
what's wrong with me ? (1 Reply)
Discussion started by: yanglei_fage
1 Replies
exit(1) User Commands exit(1)
NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps
SYNOPSIS
sh
exit [n]
return [n]
csh
exit [ ( expr )]
goto label
ksh
*exit [n]
*return [n]
DESCRIPTION
sh
exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of
the last command executed (an EOF will also cause the shell to exit.)
return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe-
cuted.
csh
exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the
expression expr.
The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches
for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to
jump to a label that occurs between a while or for built-in command and its corresponding end.
ksh
exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8
bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing
a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit
except for a shell which has the ignoreeof option (See set below) turned on.
return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the
least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return
is invoked while not in a function or a '.' script, then it is the same as an exit.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not
performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
break(1), csh(1), ksh(1), sh(1), attributes(5)
SunOS 5.10 15 Apr 1994 exit(1)