Visit Our UNIX and Linux User Community

Top Forums Shell Programming and Scripting Need help getting my output from MYSQL query into right format Post 302635323 by brianjb on Friday 4th of May 2012 03:49:16 PM
Old 05-04-2012
Wow!

You are some sort of an awk genius! I am still learning.

How would I get a blank line between each pair?

So make it:
header
actual line
blank
header
actual line
blank

etc...

What you gave me is a lot closer than I have been all week.

Here is what we have now:

Code:
Domain Name,Refresh Time,Expire Time,Retry Time,Default TTL,Negative Cache TTL,Zone e-mail address,Start Zone Options,Extensions,Prefix of zone db file,Postfix of zone db file,ALU DNS 6.0 Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,BIND-8.X Options,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,BIND-9.X Options,DNSSEC enabled zone,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 3.X Options,Import External Updates,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,LUCENT DNS 4.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 5.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,WINDOWS 2000 DNS Options,aging,allow-transfer,allow-update,no-refresh-interval,notify,refresh-interval,zone-options,End Zone Options,Start DNS Servers,Primary DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,End DNS Servers
10.in-addr.arpa.        10800   604800  3600    86400   600
Domain Name,Refresh Time,Expire Time,Retry Time,Default TTL,Negative Cache TTL,Zone e-mail address,Start Zone Options,Extensions,Prefix of zone db file,Postfix of zone db file,ALU DNS 6.0 Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,BIND-8.X Options,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,BIND-9.X Options,DNSSEC enabled zone,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 3.X Options,Import External Updates,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,LUCENT DNS 4.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 5.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,WINDOWS 2000 DNS Options,aging,allow-transfer,allow-update,no-refresh-interval,notify,refresh-interval,zone-options,End Zone Options,Start DNS Servers,Primary DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,End DNS Servers
test.com.  10800   604800  3600    3600    3600
Domain Name,Refresh Time,Expire Time,Retry Time,Default TTL,Negative Cache TTL,Zone e-mail address,Start Zone Options,Extensions,Prefix of zone db file,Postfix of zone db file,ALU DNS 6.0 Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,BIND-8.X Options,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,BIND-9.X Options,DNSSEC enabled zone,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 3.X Options,Import External Updates,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,LUCENT DNS 4.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 5.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,WINDOWS 2000 DNS Options,aging,allow-transfer,allow-update,no-refresh-interval,notify,refresh-interval,zone-options,End Zone Options,Start DNS Servers,Primary DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,End DNS Servers
time.com.   3600    86400   3600    3600    3600

How do I get it to this:
Code:
Domain Name,Refresh Time,Expire Time,Retry Time,Default TTL,Negative Cache TTL,Zone e-mail address,Start Zone Options,Extensions,Prefix of zone db file,Postfix of zone db file,ALU DNS 6.0 Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,BIND-8.X Options,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,BIND-9.X Options,DNSSEC enabled zone,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 3.X Options,Import External Updates,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,LUCENT DNS 4.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 5.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,WINDOWS 2000 DNS Options,aging,allow-transfer,allow-update,no-refresh-interval,notify,refresh-interval,zone-options,End Zone Options,Start DNS Servers,Primary DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,End DNS Servers
10.in-addr.arpa.        10800   604800  3600    86400   600

Domain Name,Refresh Time,Expire Time,Retry Time,Default TTL,Negative Cache TTL,Zone e-mail address,Start Zone Options,Extensions,Prefix of zone db file,Postfix of zone db file,ALU DNS 6.0 Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,BIND-8.X Options,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,BIND-9.X Options,DNSSEC enabled zone,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 3.X Options,Import External Updates,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,LUCENT DNS 4.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 5.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,WINDOWS 2000 DNS Options,aging,allow-transfer,allow-update,no-refresh-interval,notify,refresh-interval,zone-options,End Zone Options,Start DNS Servers,Primary DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,End DNS Servers
test.com.  10800   604800  3600    3600    3600

Domain Name,Refresh Time,Expire Time,Retry Time,Default TTL,Negative Cache TTL,Zone e-mail address,Start Zone Options,Extensions,Prefix of zone db file,Postfix of zone db file,ALU DNS 6.0 Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,BIND-8.X Options,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,BIND-9.X Options,DNSSEC enabled zone,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 3.X Options,Import External Updates,allow-query,allow-transfer,allow-update,check-names,notify,zone block of named.conf,LUCENT DNS 4.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,LUCENT DNS 5.X Options,DNSSEC enabled zone,Import External Updates,allow-notify,allow-query,allow-transfer,allow-update,notify,zone block of named.conf,WINDOWS 2000 DNS Options,aging,allow-transfer,allow-update,no-refresh-interval,notify,refresh-interval,zone-options,End Zone Options,Start DNS Servers,Primary DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,DNS Server Name,DNS Server Type,Sec DNS Update Flag,End DNS Servers
time.com.   3600    86400   3600    3600    3600

 
Test Your Knowledge in Computers #212
Difficulty: Medium
According to OSPF, an autonomous system boundary router is a router that is connected by using more than one routing protocol and that exchanges routing information with routers autonomous systems.
True or False?

8 More Discussions You Might Find Interesting

1. Programming

How to query one to many mysql

Hi there, I have a hierarchical database that include 4 tables. Table A is the parent of B, B is Parent of C, C is parent of D. If I want to query everything in D that is associated with A.name, how do I do that? Thanks! YanYan (0 Replies)
Discussion started by: pinkgladiator
0 Replies

2. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

3. Shell Programming and Scripting

Help needed to format mysql output

Hi all, Does anyone know how to format the output from mysql from within a shell script? i.e. RESULT=`mysql command` echo ${RESULT} the ${RESULT} only displays the output on one line instead of how mysql would display it as columns etc (3 Replies)
Discussion started by: muay_tb
3 Replies

4. Web Development

mysql query help

hello all i have 2 columns every column in the following format column1 2011-04-01 11:39:54 column2 2019-02-03 00:00:00 i want get difference between above data as following 2 days 11:39 how to do so ? i tried many functions but nothing works please advice what is the query... (6 Replies)
Discussion started by: mogabr
6 Replies

5. Programming

mysql query help

Hello i have created mysql query to compare to values and get difference in percentage as following: SELECT file_name, 100 - ((100 * (SELECT file_count FROM xipi_files z WHERE x.file_group = z.file_group AND x.file_name = z.file_name AND z.insert_date = CURDATE( ) - INTERVAL 1 DAY)) /... (1 Reply)
Discussion started by: mogabr
1 Replies

6. UNIX and Linux Applications

Please help: Oracle gqsql or sqlplus output format like mysql

On psql select titolo,lingua from titolo where titolo ~* 'brivid'; titolo | lingua ------- + ------ Brivido | 1 On Sqlplus/gqsql SQL> select titolo,genere,anno,lingua from titolo where titolo like '%rivid%'; TITOLO... (6 Replies)
Discussion started by: Linusolaradm1
6 Replies

7. Programming

Need help in mysql query

Hi All, i have a table in mysql with the following data Table name Test Assettype Serial_No Status location Mouse 123456 In Stock chennai Mouse 98765 Allocated chennai Keyboard ... (2 Replies)
Discussion started by: venkitesh
2 Replies

8. Shell Programming and Scripting

How to create a file from output of vertica table query in UTF-8 format?

Hello, In my shell script, I extract table data from HP Vertica DB into a csv file using vsql -c command. But the problem is the file getting created is in binary format and hence some of the data becomes unreadable which has chinese characters as part of data. file -i filename.csv - gives... (2 Replies)
Discussion started by: Dharmatheja
2 Replies

Featured Tech Videos

All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy