In lieu of processing/reading the file in reverse..I useto ensure only get first aswere in a command when get multiple answeres.Code:grep -E -m 1 "blabla"
Now my question: if I want last answer and in multiple answeres, howe to accomplished that?
awk '/blabla/ {LAST=$0} END {print LAST}'
grep "blabla" | tail -n 1
Thank you, this working fine. Tested awk couldn't get that working.In lieu of processing/reading the file in reverse..
Code:grep "blabla" | tail -n 1
Works for me...Tested awk couldn't get that working.
echo Blabla >awktest.txt
echo Blabla_second >>awktest.txt
grep Blabla awktest.txt
Blabla
Blabla_second
awk '/Blabla/ {LAST=$0} END {print LAST}' awktest.txt
Blabla_second
cat awktest.txt | awk '/Blabla/ {LAST=$0} END {print LAST}'
Blabla_second
Works for me...
Code:echo Blabla >awktest.txt echo Blabla_second >>awktest.txtCode:grep Blabla awktest.txt Blabla Blabla_secondeven this manky code works...Code:awk '/Blabla/ {LAST=$0} END {print LAST}' awktest.txt Blabla_second
Code:cat awktest.txt | awk '/Blabla/ {LAST=$0} END {print LAST}' Blabla_second
awk '/VERIFY OK: depth=0/ {LAST=$0} END {print LAST}' /tmp/vpnclient-1.log | cut -d ',' -f2 | cut -d "=" -f2
vpn63.prd.kista.ovpn.com
We use essential cookies to make this site work, and optional cookies to enhance your experience.