Scripting with Grep : how to include a variable inside a search ?
hi i made a script who works well like that
i split a log file in line
and grep the results like that :
for ligne in $(cat scangalaxies.txt); do echo -e "$ligne"; done | grep -B8 "recycle" | grep -A4 '"position":"5:\(.\)\(.\)\(.\):\(.\)"'
i want to replace the number 5 by a var (i) in my search is it possible with grep ?
i tried :
grep -A4 '"position":"\($i\):"1:\(.\)\(.\)\(.\):\(.\)"'
but it doesnt work
any help ? or maybe with sed instead ?
thx
Last edited by larotule; 08-17-2015 at 02:46 AM.
|