-2

Have following content in a text which i got from query:

    EMC Documentum idql - Interactive document query interface
    (c) Copyright EMC Corp., 1992 - 2013
    All rights reserved.
    Client Library Release 7.1.0200.0207


Connecting to Server 
1> 2> ID       Name                                                                                                                                                                                                                                                       ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
128993434  Status                                                                                                                                                                                                                                          
(1 row affected)

Requirement:- Print out as below in tabular form

ID             Name
128993434    Status

Was trying to print the content using awk as below:

awk '{if($0 !~ /--/){sub(/^ +/,"");print $0}}' output_status.txt

which is not giving me result what i want.

Please guide me.

  • Try starting simpler from awk '/--/ {print $9}' and see if you can build a solution from there. Once you get the output from awk right then try piping the output to column – bu5hman Jun 25 at 17:07
  • Have you explored the documentation for idql to see if it can produce the formatting you want? That would probably be far simpler and much more flexible than hacking an awk script onto its output, and give better results—if it's supported by the tool. – Wildcard Jun 25 at 18:10
  • 1
    One web resource says: "Unlike sqlplus, idql has no column formatting ... Needless to say, having a nicely displayed output is not possible within idql." and ends with an awk script that appears to format things nicely. – Jeff Schaller Jun 25 at 19:14
0

Done by below command

awk '/Name/||/Status/{print $0}' filename| sed "s/-//g"| sed '/^$/d'| sed "s/1> 2> //g"| sed '/^$/d'|sed '/^$/d'

output

ID       Name                                                                                                                                                                                                                                                       
128993434  Status  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.