The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-21-2007
FK_Daemon FK_Daemon is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 2
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0