Shell script [Closed]

Report
-
 your id include -
Hi

I have a text file named information.txt which contains information about Oracle Instances, I want to fetch data's from that text file and want to display an output using shell script.
i.e. when I execute that shell script ,it should read all data's from information.txt and display an output like below.
I willl try explain with an example...
Say i have a file "file" containing..
Instance : DB1,windows
Instance : DB2,unix
Instance : DB3,solaris
Instance : DB4,unix
;;;;;;;;etc


so... my shell script should read the file and display output as
DB1,windows,OK
DB2,unix,OK
DB3,solaris,OK
DB4,unix, OK
;;;;; etc

How do I write this script? Can you tell me ..which command wud be appropriate?

1 reply

Posts
40805
Registration date
Wednesday August 27, 2003
Status
Moderator
Last seen
August 10, 2020
17
Hi,

Try this :
$ cat plop
Instance : DB1,windows
Instance : DB2,unix
Instance : DB3,solaris
Instance : DB4,unix

$ sed 's/.* : \(.*\)/\1,OK/' plop 
DB1,windows,OK
DB2,unix,OK
DB3,solaris,OK
DB4,unix,OK
;-))
4
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month


thanks this right ?

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!