I am trying to pass a regular expression variable from a simple script to sed
to remove entries from a text file
e.g.
a='aaaa bbbb cccc ...|...:'
then executing sed from the script
sed s'/"'$a"'//g <$FILE > $FILE"_"1
my output file is always the same as the input file !!
any hints / pointers are aprreciated
eval should accomplish what you wish.
I am not to certain what you mean and how to pass eval the command value
Ygor
4
Use awk instead of sed...
awk '{gsub(a,b);print}' a="$a" b="" file1 > file2
thanks for the hint, bit of modification got the script working
use
double qoutes instead of single quotes wil solve the problem
sed "s/$a//g" inputfile>tempfile;mv tempfile inputfile
will give the desired result