Sponsored Content
Full Discussion: Extract words from a pipe
Top Forums Shell Programming and Scripting Extract words from a pipe Post 302534872 by acidoangel on Wednesday 29th of June 2011 03:56:03 AM
Old 06-29-2011
Extract words from a pipe

Hello,

Currently, I have this output from my application :
Code:
-------------------------------------------------
Log viewer/Tmp1 (Jun 29 2011 09:48)
-------------------------------------------------
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
-------------------------------------------------
Log viewer/Tmp3 (Jun 29 2011 09:48)
-------------------------------------------------
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
-----------------------------------------------------------------------------------------
Log viewer/Tmp350 (Jun 29 2011 09:48)
---------- DB SPECIFIC ------------------------------------------------------------------
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
-------------------------------------------------
Log viewer/TmpA (Jun 29 2011 09:48)
-------------------------------------------------
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....
-------------------------------------------------
Log viewer/TmpA (Jun 29 2011 09:48)
-------------------------------------------------
.....
-------------------------------------------------
Log viewer/TmpN (Jun 29 2011 09:48)
-------------------------------------------------

And I want extarct this information:
Code:
Tmp1
Tmp3
Tmp350
TmpA
TmpA
TmpN

Currntly I'm using this command :
Code:
MyApplication | grep -E '^Log viewer/' | awk -F"/" '{print $NF}'

But it's doesn't work well and it is ungly like hell Smilie

Con you help me ?

Thanks by advance,

Acid

Last edited by Franklin52; 06-29-2011 at 05:09 AM.. Reason: adding code tags for code
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to extract two words at the same time.

Hi, Can anyone please let me know, how to extract two lines at the same time. In specific,I have a file containing list of devices, such as router1 and switch2 below. I want to get all the lines which has "#" and all the lines which has "down" router1#sh ip int br Interface ... (6 Replies)
Discussion started by: Aejaz
6 Replies

2. Shell Programming and Scripting

Extract numbers below words with awk

Hi all, Please some help over here. I have a Sales.txt file containing info in blocks for every sold product in the pattern showed below (only for 2 products). NEW BLOCK SALE DATA PRODUCT SERIAL 79833269999 146701011945004 .Some other data .Some... (17 Replies)
Discussion started by: cgkmal
17 Replies

3. Shell Programming and Scripting

extract words from txt using perl

Hi, i will deal with txt file and i want to use perl to extract number of words from this txt ex :if the txt file is a story which contains person names and iwant to extract these names and there is something else that these names which i want perl to extract must match the words (person names) ... (2 Replies)
Discussion started by: eng_shimaa
2 Replies

4. Shell Programming and Scripting

[sed] extract words from a string

Hi, One of the scripts creates logs in the format: progname_file1.log.20100312020657 where after file the number could be from 1 to 28 and after log. the date is attached in the format YYYYMMDDHHMISS progname_file<1-28>.log.YYYYMMDDHHMISS. Now I want to discard the .20100312020657... (7 Replies)
Discussion started by: dips_ag
7 Replies

5. Shell Programming and Scripting

expr command to extract words

how to use expr command to retrieve all the words before the equal sign "=" with shell script (3 Replies)
Discussion started by: 76455
3 Replies

6. UNIX for Dummies Questions & Answers

Extract words to new file

Hi there, Unix Gurus Working with big listings of english sentences for my pupils, of the type: 1. If the boss's son had been , someone would have asked for money by now. 2. Look, I haven't a crime, so why can't you let me go? .... I wondered how to extract the words between brackets in... (7 Replies)
Discussion started by: eldeingles
7 Replies

7. Shell Programming and Scripting

Extract data b/w two words using sed

Hi, I want to extract data b/w two words with the help of sed.. Eg: In "Anna said that she would fetch the bucket", I want to display data b/w "Anna" and "would" O/P: said that she I have tried with below code, but unable to get desired o/p echo "Anna said that she would fetch the... (5 Replies)
Discussion started by: divya bandipotu
5 Replies

8. Shell Programming and Scripting

Remove whitespace after pipe symbol but not inside words

I have a file that looks like this: 102| #2 X 1/4-INCH| 30188| EA| FTW| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH 102| #2 X 1/4-INCH| 30188| EA| VPS| A| NOT SERIAL TRACKING| NOT LOT TRACKING| TRUE| #2 X 1/4-INCH 102| #6 X 1/2"| ... (2 Replies)
Discussion started by: djehresmann
2 Replies

9. Shell Programming and Scripting

Extract words before and after a certain word.

I have a sample text file with file name: sample.txt The text file has the following text. this is an example text where we have to extract certain words before and after certain word these words can be used later to get more information I want to extract n (a constant) words before and... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

10. UNIX for Beginners Questions & Answers

Extract Bracketed Words

Hi there, Unixers I need to extract ALL the words from a text which aresurrounded by square brackets. I am using this piece of code sed 's/.*\.*/\1/g' inputfile > outputfile but I only get one word for every paragraph, why? Please use CODE tags as required by forum rules! (7 Replies)
Discussion started by: eldeingles
7 Replies
All times are GMT -4. The time now is 11:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy