开发者

grep with negative condition, and more than a certain line number

i'm trying to write a grep/sed/awk for a condition from a file, and at the same time with a negative condition (does not contain xxx) and also i wanna grep all the lines that are > than a certain line numb开发者_JAVA技巧er.


Awk should deal with that nicely:

/condition/ && ! /negative condition/ { print $0; outputdone = 1 }

{ if(NR > certain_line_number && !outputdone) print $0
  outputdone = 0
}

I wasn't quite certain if all the conditions were applied together. I guessed that you always want to print lines beyond some point, but up to that point the positive and negative conditions applied.


tail -<number of lines that you want from end of file>  filename | grep -v xxx
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜