I've scoured the forum and found similar problems but I can't seem to adapt them to help me with my cause.
This is a two-part question.
I have a multi line file generated by ps | -ef
I need to print out a certain type of pattern. The pattern is part static and part dynamic.
It is a file/s(pattern) that contain/s two letters and three to four numbers and sometimes even letter at the end.
e.g GY1020.def, WN093.def and so on. The files(patterns) are located in different directories (some with very long names) so the result from "ps -ef" cuts off part of the extension (.def) so it reads WN093.d
The output from "ps -ef" looks something like this (last two columns shown below):
/bin/ksh /export/home/user/RUN/DEFFILES/GY/GY1020.def G
/bin/ksh /export/home/user/RUN/DEFFILES/WN/RST/WN093.d
/bin/ksh /export/home/user/VB9530.def /more/text/ 1
/bin/ksh /export/home/user/RUN/DEFFILES/LO/LO6002a.def
I want to print out:
GY1020
WN093
VB9530
LO6002a
alternatively: (appending .def for those that get cut off)
GY1020.def
WN093.def
VB9530.def
LO6002a.def
I know "sed" can do this and search for [A-Z][A-Z][0-9][0-9][0-9] or something similar but I cannot get exactly what I want.
The second part of my question; Is there a way to get "ps" to output ALL data and not just cut the end of as shown above?
Some help with this would be very much appreciated.