LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 10-18-2010, 07:43 AM   #1
Madison00
LQ Newbie
 
Registered: Oct 2010
Posts: 10

Rep: Reputation: 0
looking for key word on the output


below is my code:

#!/bin/ksh

HOME="/home/lnbh"
DATE=$(date)
HOSTNAME=$(hostname)
ps -ef |grep pmon > pmon.txt
db_alive=$HOME/pmon.txt

for db_name in $(cat $db_alive | cut -f3 -d

do
print $db_name
done



and below is my result:
$ ./test2.ksh
21
ora_pmon_test
27
ora_pmon_oem
54
ora_pmon_emrep
28
ora_pmon_mom
22
asm_pmon_+ASM1
42
ora_pmon_clone10g1
00


All I want is to get the name of SID which is the last word. FOr example: test, oem, emrep, mom and +ASM1 and clone10g1.

Thanks
 
Old 10-18-2010, 08:01 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
This would seem to be an exact copy (result wise at least) of your previous post found here

Not sure if you have read the LQ rules but double posting is frowned upon. Not only that but I already offered a solution ... did this not work?

Also, now that you have provided more information, does it have to be korn shell?
Also, why not just use your grep to get what you want.
 
Old 10-18-2010, 05:07 PM   #3
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed 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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
i need to access a disk-on-key with MS word/Excell files on it ahartman Linux - Hardware 5 03-23-2010 05:22 AM
find for key word ashley75 Linux - General 1 01-13-2007 10:53 PM
How to key in chinese word in suse? TigerLinux SUSE / openSUSE 2 10-10-2005 08:31 AM
grepping last word of output rajatgarg Programming 3 11-25-2003 10:41 AM
c language question: key word PARAMS powerplane Programming 4 04-30-2003 04:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration