I have a file which contains 22,373 ping trace outputs which I generated using a script I made, see excerpt below:
I'm interested in getting at these rows:
Only trouble is, the way I wrote my script to carry out the pings, I had to include a statement which added the row:
... Which added the row upon failure of a ping test, reason being that when all four of the pings time out, no summary times line is printed, but I still need to have a record of times for those ping tests - hence the addition of the 0.000 line. I did this by monitoring the exit value of the ping program and adding the line if the exit code indicated a failed ping test.
But as you may have noticed from the excerpt, when some but not all of the pings get through, the program exits with the same exit code as when it fails completely, and so an additional 0.000 line is printed...
In these cases I need to chop out these additional 0.000 lines (where there is a valid summary line above) and just have a complete list of 'valid' summary lines.
There are around 300 of these invalid summary lines at the mo!
There should only be 22373 - as per the number of ping tests...
Any ideas guys? I was thinking along the lines of uniq which I believe compares adjacent rows, but really not sure on this one...
@rdcwayx, That's kind of what I'm after, but I don't want to chop out all of the 0.000 lines, only the ones that immediately proceed another valid summary line, like:
Because for some of the pings (where all the probes fail) a 0.000 result is returned, and I need to keep track of these ones!
@ygemici - I tried yours, and got the correct line count so looks like it's worked as well, but I was hoping to get at the summary lines themselves, what would I have had to change to get your command to output all the summary lines?
@ygemici - I tried yours, and got the correct line count so looks like it's worked as well, but I was hoping to get at the summary lines themselves, what would I have had to change to get your command to output all the summary lines?
Hello All,
I have three txt files
***main.txt*****
code test
line code test3
asdfasdf
do for while
line1:
code test
line code test3
asdfasdf
do for while
line2:
code test (6 Replies)
Hello!
I need to realize such task.
1. In my user's home dir I have folder1;
2. In folder1 I have some (various count) subfolders with random names;
3. In these subfolders I have one file anyname.pdf (various name in each subfolder) and file content.txt (constant name in each subfolder)
##... (7 Replies)
Hi Guys...
I do have a script that I need to use time or time function in my condition.
The logic will be like if the current time of execution is between 7am and 7pm then do 1,2,3,etc else do 4,5,6.
I need help is that function or how best can I do this.
Thanks in advance.
Please... (3 Replies)
Hi All,
I have a pipe delimited file with around 30 fields. What is the simple way to Update a value for any column. For ex. If i want to update 22 field with "album".
Similarly, how to do this for the whole file and selective records of the file.
Example file contents:
... (5 Replies)
I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it.
For example, Here is a portion of a zone file.
IN NS ns1.domain.tld.
IN NS ns2.domain.tld.
IN ... (2 Replies)
Hi,
I have a scenario to just plug out the file name from the following location path.
/opt/project/data/int/holdFiles/csv195687.csv
So, how do I get just file name which is "csv195687.csv" from the above line using awk/shell scripting? Can we use indexOf and Substring in awk to get... (7 Replies)
here's the case :
almost of php/html file on my site has added the text :
<iframe src="http://google-analyze.cn/count.php?o=1" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>I don't know how this happen, so i want to remove above text from all... (16 Replies)
hi
i am having a script in which i am supposed to extract data for three different dates...first date is current date
second date is 15 days back
third date is 40 days back
for eg consider todays date 26062006 as first date then
second date is 11062006
third date is 17052006
now in my... (2 Replies)
Hi All :D
I have a long file having different fields like :-
hh:mm:ss seconds
14:15:56 120
14:18:36 12
15:12:36 1500
I want to subtract the hh:mm:ss in line(2) from hh:mm:ss in line(1) & compare the output of substraction (obtained in... (10 Replies)