Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Pipe awk's output to sed for deletion

$
0
0
Hi Friends,

I am using a command that prints certain lines from a file.

For ex:

cat input

Code:

abc chr1 456
def chr1 789
ghi chr1 999
jjj chr1 777
jhk chr7 914

My command

Code:

awk '{if($2=="chr1" && $3>=456 && $3<=999) {print $0}}' OFS="\t" input
Output being printed is
Code:

abc chr1 456
def chr1 789
ghi chr1 999

I want to pipe this output to sed or whatever to delete these lines. Maybe like this

Code:

awk '{if($2=="chr1" && $3>=456 && $3<=999) {print $0}}' OFS="\t" input | sed '/d/'
My final required input file should be

Code:

jjj chr1 777
jhk chr7 914

I don't want to try it for myself because it is a huge 27GB input file. Any mistakes will cost me money and time to regenerate it.

Viewing all articles
Browse latest Browse all 16232

Latest Images

Trending Articles



Latest Images