Microsoft
Software
Hardware
Network
Question : sed/awk help
Hi, i've got a file composed of this kind of stuff:
python3 Solaris zone 2G-05 colt zfs syslog-ng nemo env-testing-qa1 amadeusapi cachemanager
python4 Solaris zone 1G-05 colt zfs syslog-ng nemo env-dev-qa1 apache2
python5 Solaris zone 2G-30 colt zfs syslog-ng nemo env-dev-qa1 jboss
python6 Solaris zone 2G-05 colt zfs syslog-ng nemo env-dev-qa1 amadeusapi cachemanager
python7 Solaris zone 1G-05 colt zfs syslog-ng nemo env-testing-qa2 apache2
python8 Solaris zone 2G-30 colt zfs syslog-ng nemo env-testing-qa2 jboss
python9 Solaris zone 2G-05 colt zfs syslog-ng nemo env-testing-qa2 amadeusapi cachemanager
bergman1 Solaris zone 17G-30 colt zfs syslog-ng nemo env-load-qa1 jboss
and i need to keep all words starting with env, but excluding "env-":
testing-qa1
dev-qa1
dev-qa1
...
How i can do that with sed or awk? (preferably sed)
Thanks!
Answer : sed/awk help
sed 's/.*env-\([^ ]*\) .*/\1/' sample.txt
> extract.txt
or
sed -i 's/.*env-\([^ ]*\) .*/\1/' sample.txt
Random Solutions
Microsoft Information Store stalling issues
Asp.Net I am having problem trying to access a page & passing it querystring value.
SQL union to fill date data series gaps for SSRS year on year chart
A* algorithm 2D snake with obstacles max route
Intermittent internet connectivity for PCs in small remote office
DAG & CAS array configured but it's not failover
Domain user account continuously getting locked out.
how to save blackberry notes
Track external IP address in ASA.
UTF-8 encoding