HI
I have something like this in a file
ABC = 1
DEF = 2
GHI = 3
JKL = 4
MNO = 5
QRS = 6
TUV = 7
I need to assign ABC to V_abc \(that is to a variable\)
GHI to V_ghi \(that is to another variable\)
TUV to say V_tuv
What i mean to say is that i have many values in a file and i need some of them
I tried grep but it is not working
Any help is appreciated
Thanks in advance
eval `sed 's/ //g;s/^/v_/' filename`
The sed script removes the spaces and prepends v_ to each line in the file, and then eval evaluates it in the current shell, which causes the variables' values to be assigned.
Hi
even if i give the way you have given
eval `sed 's/ //g;s/^/v_/' filename`
it is appending v_ to everything in the file
but not printing the v_abc value on the console
if i give in the following way
eval `sed -e 's/abc/v_abc/g' ${dirold}/eng/file23.txt`
then also it is not printing the value
Of course it is not printing the value. You said nothing in your original post about printing values, all you asked for was to assign them to a variable.
If you echo $v_ABC after running the command I gave you, it should display "1".
awk '{print "V_"tolower($1),$2}' filename > newfile
your new file will have
V_abc=1
V_def=2 so on....
use or redirect it to your acript inside script they work as variables 
Don't you mean:
awk '{print "V_"tolower($1)"="$2}' filename > newfile
oh ya exactly.. thanks for correcting me.. annihilannic.