I have a log file containing the below data and should have the output file as below. and the output file should not contain any 0 values.
Eg. It should not contain 0000000:0000000 in it.
input.txt
Media200.5.5.1 00010003:065D1202
Media100.5.5.2 7,588,666,067,931,543
Media100.5.5.3 0
Media200.5.5.4 1
Media200.5.5.5 4
Media200.5.6.1 00010002:065D1202
Media200.5.6.1 00000000:00000000
Media200.5.6.2 7,588,727,347,785,821
Media300.5.6.3 0
Media500.5.6.4 1
Media700.5.6.5 1
Media300.5.7.1 00010003:065D1202
output.txt
Media200.5.5.1 00010003:065D1202
Media200.5.6.1 00010002:065D1202
Media300.5.7.1 00010003:065D1202
Could anyone please help with shell script for the above ...
joeyg
January 22, 2013, 10:06am
2
Is there an additional condition?
that the line contain a 17-character string, as in
xxxxxxxx:xxxxxxxx
That seems to be how you eliminate the 2nd-5th lines
There is no such condition. But the only thing is the final output should not contain
00000000:00000000 values
joeyg
January 22, 2013, 10:16am
4
So, output should be ?:
Media200.5.5.1 00010003:065D1202
Media100.5.5.2 7,588,666,067,931,543
Media100.5.5.3 0
Media200.5.5.4 1
Media200.5.5.5 4
Media200.5.6.1 00010002:065D1202
Media200.5.6.2 7,588,727,347,785,821
Media300.5.6.3 0
Media500.5.6.4 1
Media700.5.6.5 1
Media300.5.7.1 00010003:065D1202
eliminating the one entry with 00000000:00000000
no sir...
The output should be as mentioned above..
Media200.5.5.1 00010003:065D1202
Media200.5.6.1 00010002:065D1202
Media300.5.7.1 00010003:065D1202
I need to have the o/p as shown above.. contains only the non zero values in the above format. And this values eg 00010003:065D1202 will be change other than zeros.
Yoda
January 22, 2013, 10:37am
6
How about?
awk '/:/&&!/00000000:00000000/' log_file
Please try this, it will work
grep ":" $file | sed "/00000000:00000000/d"