the following will only work if the pattern in bold occurs in the specified places always n the length of the pattern also remains same. m is the file in which i have stored the file u had given.
x=`sed -n 1p m|awk -F"^" '{print $1}'|cut -c 1-12`
y=`sed -n 2p m|awk -F"^" '{print $7}'|cut -c 2-14`
I have a tag in the file it's 35=D before this tag i have the time of the tag which I mentioned about it before and after the 35=D I have another tag which is 11=some string ex(11=0011IN)
so the file look like that
If the line contains the pattern 35=D then execute the commands within the paranthesis.
N
get the next line and append it to the pattern space
/11=/{..}
If the pattern space contains the pattern 11= then execute the commands within the paranthesis.
s/^\([^ ]*\).*\n.*\(11=[^^]*\).*$/\1 \2/p
What we need in the first line is "09:30:04,438" which is separated from next word by space. This string is matched by \([^ ]\). The next string is matched by \(11=[^^]\) which is separated from the next field by ^.
thank you for all this method was work very fine
x=`sed -n 1p Husam1.sh|awk -F"^" '{print $1}'|cut -c 1-12`
y=`sed -n 2p Husam1.sh|awk -F"^" '{print $7}'|cut -c 5-14`
but I need some one to explain in breaif becuase I don't under stand this two statment.
and can any help,
how can I subtract x from itself or any variable like it so I can get the result
for example if i subtract x from It self i will get zero