I have tested and tried to edit my script with yout advice.. but still unable to get the value of PWD to replace my copy of shell script.
I have 2 shell script, a.sh and b.sh.
a.sh will make a copy of b.sh at /etc/init.d and will replace the "$PWD" keyword in the copy of b.sh.
Below is the edited code for my scripts:
a.sh
b.sh
when i execute the a.sh... the keyword PWD in copy of b.sh is replaced with the string "$current_dir"
and eventually i have this
current_dir=""$current_dir""
in my copyOf b.sh....
I tried to manipulate the quotes.. but still unable to get the thing right...
Hi there. If variables are named inside of a ksh script, how is it possible to pass these to sed?
The affected portion of my script goes something like this:
A=`cut -d. -f1 $FILE`
B=`cut -d. -f2 $FILE`
C=`cut -d. -f3 $FILE`
sed 's/1111/$A/g;s/2222/$B/g;s/3333/$C/g' file > anotherfile
... (2 Replies)
Hi, Thanks for looking,,,,
(kornshell)
tmp3 is a list of line numbers
I want to print the lines from my list
code:
while read j
do
echo $j #works fine
echo $filename #works fine
#sed "'$jp'" "$filename" ... (7 Replies)
Hello,
I'd like to pass a variable to a sed command in a perl script. The script is like this :
#!/usr/bin/perl -w
$newline="new";
system q(sed '/insert/ i\ '$newline <sed1.txt >sed2.txt);
But the interpretor wouldn't recognize $newline, it inserts a "\n" instead.
I've also... (4 Replies)
hi all
is possible to pass shell (bash) variable to sed like it is in awk?
example:
awk script is storred in awk.awk file and I am passing variable called var to this file.
$ cat awk.awk
{if ($5==var) print $0}
so it works when i issue
$ bash_var=24
$ ls -l | awk -v... (1 Reply)
Ok, so, let's say I have the variable $GMAILID....How can I use it with sed command so to replace a string in a file? e.g.:
sed -i 's/$GMAILID/test@gmail.com/' /home/$USER/Desktop/sendmail (4 Replies)
Hi,
I am trying to replace the value of a variable in a file through another script.
Example:
Filename : abc.txt contents:
a=10
b=20
c=30
Need to change the value of, say, b - Tried using the following:
sed "s/${b}/15/g" abc.txt
Have tried various forms of sed (with single quotes,... (4 Replies)
I have a file having some text like:
PATH_ABC=/user/myLocation
I have to replace "/user/myLocation" with a session variable say, $REPLACE_PATH,
where $REPLACE_PATH=/user/myReplaceLocation
The following sed command is not working. It is writing PATH_ABC=$REPLACE_PATH in the file
... (2 Replies)
I'm trying to create a ksh script that will ask the user for the port number. $PORT1 is the variable I want to use that will contain whatever numbers the user inputs. The script would edit ports.txt file, search and delete "./serv 110.1.0.1.$PORT1 200;=3" .
So if the user types 50243 then the... (5 Replies)
I want to make a config file which contain all the paths.
i want to read the config file line by line and pass as an argument on my below function.
Replace all the path with reading config path line by line and pass in respective functions.
how can i achieve that?
Kindly guide.
... (6 Replies)
Hi All
I have one file with multiple lines in it, each line has static text and some variable enclosed in <<filename>> as well. e.g. as below
123, <<file1.txt>> this is my name, I stay at <<city.txt>> Thanks for visiting
348384y, this is my name <<fileabc.txt>>, I stay at near the mall of... (8 Replies)
Discussion started by: reldb
8 Replies
LEARN ABOUT CENTOS
pwd
PWD(1) User Commands PWD(1)NAME
pwd - print name of current/working directory
SYNOPSIS
pwd [OPTION]...
DESCRIPTION
Print the full filename of the current working directory.
-L, --logical
use PWD from environment, even if it contains symlinks
-P, --physical
avoid all symlinks
--help display this help and exit
--version
output version information and exit
NOTE: your shell may have its own version of pwd, which usually supersedes the version described here. Please refer to your shell's docu-
mentation for details about the options it supports.
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report pwd translation bugs to <http://translationproject.org/team/>
AUTHOR
Written by Jim Meyering.
COPYRIGHT
Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO getcwd(3)
The full documentation for pwd is maintained as a Texinfo manual. If the info and pwd programs are properly installed at your site, the
command
info coreutils 'pwd invocation'
should give you access to the complete manual.
GNU coreutils 8.22 June 2014 PWD(1)