![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| make multiple line containing a pattern into single line | VTAWKVT | Shell Programming and Scripting | 13 | 12-04-2008 06:40 PM |
| Grepping 1 line above and below pattern | iAm4Free | Shell Programming and Scripting | 4 | 10-07-2007 11:24 PM |
| add a line after a pattern | melanie_pfefer | Shell Programming and Scripting | 2 | 05-07-2007 02:38 PM |
| sed - Replace Line which contains the Pattern match with a new line | kousikan | Shell Programming and Scripting | 2 | 03-24-2007 07:24 AM |
| Replacing more than 1 pattern in a line | Manan | Shell Programming and Scripting | 6 | 12-28-2006 01:58 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Printing out pattern in line
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. Last edited by FK_Daemon; 11-21-2007 at 10:57 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|