UNIX inquiry for 'awk'


 
Thread Tools Search this Thread
# 1  
RedHat UNIX inquiry for 'awk'

Hello Everyone,

May I ask for your help regarding one of the UNIX command “awk”. So I executed a script and the output looks like this (see below):

output.txt

Code:
CONTRACTNAME                                                                                                                                                           
CONTRACTKEY                                                                                      STATUS
WirelessSalesWeb use of IRISAutographService_v2_1 (2.1)                                                                                                                
58e9e440-a721-11e4-a161-901f801762ca:2579                                        Production

CONTRACTNAME                                                                                                                                                         
CONTRACTKEY                                                                                      STATUS
WirelessSalesWeb use of CreditCardMgmtService_v1_0 (1.0)                                                                                                               
0882528f-5933-11e4-9ee3-abe338c1dc06:2254                                        Production


But I want the output to be like this (neat column format):


Code:
CONTRACTNAME            CONTRACTKEY              STATUS                                                                                                                    
<result>                      <result>                     <result>

Can you help me on this?

Last edited by Corona688; 02-04-2015 at 02:46 PM..
# 2  
How about showing your code so we can hint you to a solution?
# 3  
Hello RudiC,

What my code does is to read all the data from contracts_report.txt line per line then output the result in output.txt

contracts_report.txt contains the data.
output.txt = result

Code:
$ more reports_contract.sh 
#!/bin/sh

SPECS=<path>
OUTPUT_DIR=<path>
LD_LIBRARY_PATH=<path>:$LD_LIBRARY_PATH
PATH=<path>:$PATH
export LD_LIBRARY_PATH
export PATH
export SPECS
sub="%"

cat $SPECS/contracts_report.txt | while IFS= read -r line
do

echo exit | sqlplus -S -L '<username>/<pass>@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=<DB host>)(Port=<DB port>))(CONNECT_DATA=(SERVICE_NAME=<SERVICE_NAME>)))' @$SPECS/<sql query>"'$line$sub'" >> $SPECS/output.txt

done

But I want the result to be in a neat column format, no need to sort. Smilie

Last edited by Scrutinizer; 02-04-2015 at 09:44 PM.. Reason: code tags
# 4  
Please use code tags as required by forum rules!

From what I see resp. infer I don't think you need to postprocess your SQL query. Use e.g. set linesize or column format statements in the SQL query to adapt your output format. Pls refer to the sqlplus manual as my sql is somewhat rusty.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #732
Difficulty: Easy
In BASIC, GOTO jumps to a numbered or labelled line in the program.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Inquiry: NIS configuration setup

Hello, Good day. I would like to ask for your inputs on this scenario. Currently, we have a NIS virtual machine with a Solaris 10 (32-bit) OS. And also we have another virtual machine with the same OS. And I am asked to set-up a secondary NIS on this another VM, bring down the primary NIS and... (0 Replies)
Discussion started by: SystemAddict
0 Replies

2. UNIX for Dummies Questions & Answers

UNIX Inquiry for Automatic Sending

Hi Everyone! I'm new with UNIX,so, sorry if this question seems really dumb.:( Anyway, I'd just like if it's possible to automatically inform someone (via mail or pop-up box or something) that a file has been recently uploaded/received to the UNIX box? If it is, any advice on how to get that... (1 Reply)
Discussion started by: jam04
1 Replies

3. UNIX for Dummies Questions & Answers

UNIX Inquiry

Hi Everyone! I'm new with UNIX,so, sorry if this question seems really dumb.:( Anyway, I'd just like if it's possible to automatically inform someone (via mail or pop-up box or something) that a file has been recently uploaded/received to the UNIX box? If it is, any advice on how to get that... (0 Replies)
Discussion started by: jam04
0 Replies

4. Shell Programming and Scripting

Inquiry on Grabbing info from file.

Here is another script I am trying to customize currently, this script is used to send me disk space information, but at the moment I have to enter all the servers in manually SERVER= "xxx bbb ccc" ect.. how can I script it so that the servers are called off a txt file versus me entering all... (1 Reply)
Discussion started by: NelsonC
1 Replies

5. UNIX for Dummies Questions & Answers

Offline Agents Inquiry.

Hello, I currently use Solaris, and typically I use the svcs -a | grep PROCESS to see if it's online or Offline. My questions is SVCS is in solaris but if I want to find out if a daemon or process is offline what other methods can I use? ps -ef | grep PROCESS "what do I look for" or... (1 Reply)
Discussion started by: NelsonC
1 Replies

6. Infrastructure Monitoring

Firewall / Network isolation inquiry

Good morning folks, A good friend of mine has a network where every host has two paths to the file servers (two NICs & two networks for all hosts). Normally speaking, one network will be used for regular application traffic - license servers, itunes library, collaboration tools - while the... (4 Replies)
Discussion started by: avronius
4 Replies

7. Linux

slave bind name resolution inquiry

hi. i configured a master and slave bind server on my vmware test network. i used nslookup to the slave name server to lookup a fake entry for network.com that the master dns set, however, the slave is resolving the real ip of www.network.com, instead of what the master dns server set. i checked... (2 Replies)
Discussion started by: marcpascual
2 Replies

8. Programming

Performance inquiry...guestimate better approach

So, I've been told and heard a million times that malloc and free are expensive calls to be avoided. So many times I avoid malloc by reusing already allocated memory blocks. Store them on free lists somewhere myself and don't call free when I know malloc will be called very shortly thereafter. ... (6 Replies)
Discussion started by: DreamWarrior
6 Replies

9. UNIX for Dummies Questions & Answers

uniX iNQUIry from a newbie

hi, i would like to study unix but i don't have the software for me to test the scripts that i read from the book and from the internet. I would like to ask anyones help to please tell me link wer i can download for free the unix system. I would be glad to receive your replies. thanks, (2 Replies)
Discussion started by: youdexter
2 Replies

Featured Tech Videos