![]() |
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 |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use ftp command in shell script | infyanurag | Shell Programming and Scripting | 3 | 02-05-2008 08:06 AM |
| cd command is not working in my shell script | amitrajvarma | Shell Programming and Scripting | 3 | 10-03-2007 05:04 AM |
| how to use cd command in shell script | LAKSHMI NARAYAN | Shell Programming and Scripting | 3 | 09-09-2007 06:04 AM |
| vi command in shell script | bryan | UNIX for Dummies Questions & Answers | 2 | 05-23-2006 07:51 PM |
| Shell script command | dipanrc | Shell Programming and Scripting | 7 | 11-29-2005 11:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
shell script command
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? |
|
||||
|
Does the value "OK" depend on some calculation, or do you just want to wipe the first field and add "OK" at the end on all lines?
Code:
sed -e 's/^Instance : //' -e 's/$/,OK/' file |
|
||||
|
Quote:
check out the last line in the input file Code:
awk 'length($3) { print $3, "OK" }' filename
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| awk, sed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|