Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Unix Command to timestamp the output of a file, but with the relative-to-when-it-started time?

Here's one way:

#!/bin/bash
SECONDS=0    # it will already be initialized to zero at the start of the script
while read -r line
do
    echo "$SECONDS: $line"
done < file    # or < <(command)

SECONDS is a variable that automatically increments every second.

Tags:

Time

Unix

Command Line Interface

Bash

Related

Secure remote RDP worker prevent file transfer Connecting to MySQL from PHP is extremely slow How can I configure openvpn server without push default gateway? How do I find broken symlinks automatically on Windows? Assessing equipment damage following a lightning strike - Should I have planned more? Setting up Subdomains within Amazon AWS Elastic Beanstalk How to diagnose a 500 Internal Server Error on IIS 7.5 when nothing is written to the event log? How to fix postfix: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))? Incredibly low KVM disk performance (qcow2 disk files + virtio) Deciphering continuing mpt2sas syslog messages Passing default answers to apt-get package install questions? How can I edit the welcome message when ssh start?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy