10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
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
2. Shell Programming and Scripting
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)
Discussion started by: sadique.manzar
6 Replies
3. Shell Programming and Scripting
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)
Discussion started by: seekryts15
5 Replies
4. Shell Programming and Scripting
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)
Discussion started by: SKhan
2 Replies
5. Shell Programming and Scripting
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)
Discussion started by: rituparna_gupta
4 Replies
6. Shell Programming and Scripting
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)
Discussion started by: hakermania
4 Replies
7. Shell Programming and Scripting
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)
Discussion started by: wakatana
1 Replies
8. Shell Programming and Scripting
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)
Discussion started by: hi_ryo
4 Replies
9. Shell Programming and Scripting
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)
Discussion started by: JohnMario
7 Replies
10. Shell Programming and Scripting
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)
Discussion started by: kristy
2 Replies