Grep pattern after specific line number in a file -
i running while loop in script ro read file line line.
now want run grep on lines below line being read while loop.
eg:
if while loop on line 4 of file, grep runs below line 4 , not include line 1,2 , 3.
how achievable ?
regards.
you can't grep alone, can if use friends:
tail +100 file_im_searching | grep pattern_i_want
using +
option can tell tail how far file start. if kept track of line number in while loop, this:
tail +$linenumber file | grep pattern
looking @ details of question, however, wonder if you'd better off passing line have through grep or sed or something..
for example, supposing have read line variable line
, perhaps:
set result = $(echo $line | grep stuff_to_search_for)
Comments
Post a Comment