Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

0 votes

bash + how to insert date before line

You might be interested in the ts command: $ echo "hello world" | ts May 23 08:41:46 hello world $ echo "hello world" | ts '%F %T -' 2024-05-23 08:42:46 - hello world Or, bash's ...
glenn jackman's user avatar
0 votes
Accepted

bash + how to insert date before line

The command you can use is echo $(date) "this line is test line" This will echo the result of execution of command date and append to the end the desired text
Romeo Ninov's user avatar
  • 6,405
3 votes
Accepted

How to extract a text in between two patterns (potentially containing floating lookbehind) with only one invocation?

Use reset operator: \K $ echo 'xxx "yyy zzz"' | grep -Po 'xxx\s+"\K.*?(?=\s)' yyy
Toto's user avatar
  • 18k

Top 50 recent answers are included