Am trying to substitute the value of a shell variable with the value of another shell variable. The values are obtained into the shell variables through some other processing.
for ex.
Quote:
var1=regno
var2=usn
now i want to replace "regno" with "usn" in a file
i've used the follow sed command..
i've also tried the other alternatives i found searching the threads. But nothing worked.. .
Please help!
Hi
I have a variable whose value is like this
i=/test/test1/test2/myfile.cd.070505123457
i would like to have the value of myfile.cd stored into another variable
my attempt is
test=${i##*/} ;echo $test ##and i get
myfile.cd.070505123457
since what i wnat is myfile.cd i try this... (19 Replies)
My specific goal: automatically edit a Makefile variable's (EXTRAVERSION)
value in a kernel Makefile.
So, I have a shell script that takes one parameter, a version string:
buildkernel.sh 2.6.18.21.7-custom
In the script, I assign the parameter to K_VER:
K_VER="2.6.18.21.7-custom"... (2 Replies)
Hello,
I wonder if it is possible to pass and use variables from shell environment into sed or awk. I am trying to achieve something similar to the following using sed or awk:
var=some_regular_expression
grep "$var" filename # Will extract lines from filename
The following code,... (3 Replies)
Hi ,
I am stuck up in the below scenario:-
I need to read a file name (eg A.txt) name frm another file (eg B.txt) and then I need to search for a particular expression in A.txt and substitute it with another expression.
How can I use SED inside SHELL Scripting and command prompt as well to... (1 Reply)
Hi,
I have to read a file and translate the contents including substituting the variables if any and write to another file without using sed or awk.
For ex:-
inputfile.txt
-----------
servername=$SERVER
application=$APPL
outputfile.txt
------------
servername=actual server name... (2 Replies)
Hi,
I'm using an array that contains compiler FLAGS
that need to be executed either before ./configure
or after the main 'make' command.
example of array containing compiler flags.
-------------------------------------------------
FLAGS="CFLAGS=\"-arch x86_64 -g -Os -pipe... (7 Replies)
hi guys,
The following command doesn't seem to work in my shell script:
tag=$(sed -n '/${line}/ s/.*\.*/\1/p' myfile.txt)
When i replace the ${line} with an actual value, it works fine.
So, how do i use the ${line} in this sed command?
Thanks in advance,
Zaff (2 Replies)
I have a file with some numbers having single quotes around them which I want to remove.
i.e. '923930' -> 23930
If it can be done without using sed thats fine. I have tried with sed but can't think how to replace this pattern on only the numbers (13 Replies)
hello!
I am trying to use sed to copy specific set of lines from a file for which the starting and ending line numbers of the lines to be copied are stored in shell variables. How can i copy those lines?
if the input_file is something like this
and if the following is the script
a=2
b=4... (4 Replies)
To all geeks,
What I want to achieve:
1. Accept two filenames from user and store the filenames in two variables (FILE1 and FILE2)
2. Check if files exisits. If doesn't, then exit
3. If files exist, look for a particular string in both files
4. If the string exists, then change the... (8 Replies)