Hi there every body
I'm new to shell scripting and there is a problem facing me,, please look at the following piece of code:
awk '
BEGIN{
FS="<assertion id=\1";
RS="<assertion id=\"2"}/<assertion id=\"1/{print FS$2 > "/home/ds2/test/output.txt"}
' filename
all I wanna do is to replace the 1 found in FS with a variable that can be changed dynamically as follows:
var=1
awk -v var1="$var" ' /var1/
BEGIN{
FS="<assertion id=\"var1";
RS="<assertion id=\"2"}/<assertion id=\"var1/{print FS$2 > "/home/ds2/test/output.txt"}
' filename
but it doesn't work so pls couldany one help me???