Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
date +"%Y-%m-%d"; while true ; do ping -n 1 google.ca | head -n 3; date +"%T" ; sleep 5 ; done
in a console for my short-term documentation. I'd like to do something similar for longer-term, so I'd like it to be output to a file. I'd like for the output to be in "pinger-5secs-YYMMDD.tsv" and for the TSV to contain the columns "Time" & "Reply ms".
I'm thinking for reply ms the above (
Code:
ping -n 1 google.ca | head -n 3
) can be taken and run through a regex for the # right after "ms=", and if there's none insert something to show that, ie the character ' ⃠ '. I foresee the time remaining the same (
Code:
date +"%T"
). Of course since it's a TSV, a tab between the 2.
YYMMDD is to be replaced by the date of the same format. Only the # in "ms=#" is to be kept from the ping. I don't see a tab being used to separate the data in 2 columns.
Write it the way that you wish. Show the script that you have written, and where it is having problems. The idea is for you to do it yourself. Not someone write it for you.
Quote:
YYMMDD is to be replaced by the date of the same format.
date +"%Y-%m-%d"; while true ; do ping -n 1 google.ca | head -n 3; date +"%T" ; sleep 5 ; done
in a console for my short-term documentation. I'd like to do something similar for longer-term, so I'd like it to be output to a file. I'd like for the output to be in "pinger-5secs-YYMMDD.tsv" and for the TSV to contain the columns "Time" & "Reply ms".
I'm thinking for reply ms the above (
Code:
ping -n 1 google.ca | head -n 3
) can be taken and run through a regex for the # right after "ms=", and if there's none insert something to show that, ie the character ' ⃠ '. I foresee the time remaining the same (
Code:
date +"%T"
). Of course since it's a TSV, a tab between the 2.
Thank you kindly for your help
You can use an already-existing tool for such things, unless you very specifically NEED a TSV file https://oss.oetiker.ch/smokeping/
Some or many routers along the path might have been set to delay or deny ping on load. Ping isn't a great tool anymore. Use other tools for displaying the full path and in the IP version you want or need.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.