I have tried by google but unable to find.
I wanted to grep string from below no. of files which is most recent files.
by using this command i am able to fetch most recent file but , not able to grep in that file only.
ls -lrth -rw-r--r--. 1 user pg_user 1712804 Jul 13 22:27 postgresql-2021-07-13_000000.log -rw-r--r--. 1 user pg_user 0 Jul 14 00:00 postgresql-2021-07-14_000000.log
$ ls -lt postgresql-*.log | head -n 1 -rw-r--r--. 1 user pg_user 0 Jul 14 00:00 postgresql-2021-07-14_000000.log
now, I want to grep “string” in postgresql-2021-07-14_000000.log
How i can combine both in one command to get output with echo on screen. like below but someting is i am missing.
$ls -lt postgresql-*.log | head -n 1 | grep "system is ready"