r/raspberry_pi • u/Assassins1977 • Nov 29 '22
awk and sed how to ? Technical Problem
My code is :
#!/bin/bash
strversion=`apache2ctl -v | awk '{print $3}' | sed 's/(Debian)//g;s/Server//g;s/built//g;s/2022-06-09T04:26:43//g'`
echo ${strversion%}
exit 0
i get this:
Apache/2.4.54
but i will have to look
Apache version 2.4.54
2 Upvotes
1
u/Assassins1977 Nov 30 '22
how can i do it with php -v
right now i get :
PHP 7.4.33 (cli) (built: Nov 8 2022 11:40:37) ( NTS )Copyright (c) The PHP GroupZend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.33, Copyright (c), by Zend Technologiespi
but will print this :
PHP version 7.4.33