Sponsored Content
Full Discussion: help with data formatting
Top Forums Shell Programming and Scripting help with data formatting Post 302587727 by agama on Thursday 5th of January 2012 06:41:40 PM
Old 01-05-2012
Assuming that the the area-code (xxx) is always after the 'break point', and is always present, this might work:

Code:
awk '
    /\([0-9][0-9][0-9]\)/ {
        if( buffer )
            printf( "%s%s\n", buffer, $0 );
        else
            print;
        buffer = "";
        next;
    }
    { buffer = $0; }
' input-file >fixed-file

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Formatting Data

i am writing a script that reads in a file and i just want it to print each element on a new line here is my code and the data that i want to read in #!/usr/bin/perl use strict; use CGI qw(:standard); use CGI qw(:cgi); my $data_file = "/tmp/results.txt"; my $configuration; my... (3 Replies)
Discussion started by: nmeliasp
3 Replies

2. Shell Programming and Scripting

Re-formatting of data display

Hi All, I have been trying to re-arrange the below data using AWK or Perl. Can anybody help me ? Thanks in advance. Input: 111 222 333 444 AAA BBB CCC DDD 555 666 777 888 EEE FFF GGG HHH Output: (6 Replies)
Discussion started by: Raynon
6 Replies

3. Shell Programming and Scripting

Script for data formatting

Hi I have to convert the data in a file ******* 01-20-09 11:14AM 60928 ABC Valuation-2009.xls 01-20-09 11:16AM 55808 DEF GHI Equation-2009.xls 01-20-09 11:02AM 52736 ABC DF Valuation-2009.xls 01-20-09 11:06AM 89600 THE... (6 Replies)
Discussion started by: shekhar_v4
6 Replies

4. UNIX for Dummies Questions & Answers

Data manipulation/ formatting question

How would I get this output to look $ cat newfile 13114 84652 84148 LIKE THIS?: 13114,84652,84148 sed,cut awk? syntax? (2 Replies)
Discussion started by: ddurden7
2 Replies

5. Shell Programming and Scripting

Formatting Data - CSV

I want to check whether if any column data has any + , - , = prefixed to it then convert it in such a form that in excel its not read as formula. echo "$DATA" | awk 'BEGIN { OFS="," } -F" " {print $1,$2,$3,$4,$5,$6,$7,$8.$9,$10,$11,$12}' (4 Replies)
Discussion started by: dinjo_jo
4 Replies

6. Shell Programming and Scripting

Formatting input data

Hello everybody, I have a file containing some statistics regarding CPU usage. The file has this syntax : Fri Jul 16 14:27:16 EEST 2010 Cpu(s): 15.2%us, 1.4%sy, 0.0%ni, 82.3%id, 0.1%wa, 0.0%hi, 0.9%si, 0.0%st Fri Jul 16 15:02:17 EEST 2010 Cpu(s): 15.3%us, 1.4%sy, 0.0%ni, 82.3%id, ... (9 Replies)
Discussion started by: spiriad
9 Replies

7. UNIX for Advanced & Expert Users

formatting the data

HI I want to make it single row if start with braces i.e. { .Any idea {1:XXX2460275191}{2:SEC00687921131112201641N}{3:{58910}}{4: :R:GENL :C::xx//xx1 :20C::yy//yy1 :2S:xxT} {1:XXX2460275190}{2:SEC00687921131112201641y}{3:{58911}}{4: :z:GENL :v::xx//xx1 :10C::yy//yy1 :4S:xxT ... (2 Replies)
Discussion started by: mohan705
2 Replies

8. Shell Programming and Scripting

Help with data formatting

Hi, I am generating the following output from my script. Country,A,B,C,D,E,F INDIA ,3755019,774604,484749,329838,7333612,442031 CHINA ,3716520,889197,530899,379754,6198475,355768 JAPAN ,52038,30462,231224,147275,1272,498 USA,9494,1130,0,0,15303,451... (5 Replies)
Discussion started by: karumudi7
5 Replies

9. Shell Programming and Scripting

Data formatting using awk

Need assistance on the data extraction using awk Below is the format and would like to extract the data in another format ------------------------------------------------------------------------------------------------- Minimum Temperature (deg F ) DAY 1 2 3 4 5 6 7 8 9 10 11... (4 Replies)
Discussion started by: ajayram_arya
4 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> ldns_buffer* ldns_buffer_new(size_t capacity); void ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size); void ldns_buffer_clear(ldns_buffer *buffer); int ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...); void ldns_buffer_free(ldns_buffer *buffer); void* ldns_buffer_export(ldns_buffer *buffer); DESCRIPTION
ldns_buffer_new() creates a new buffer with the specified capacity. capacity: the size (in bytes) to allocate for the buffer Returns the created buffer ldns_buffer_new_frm_data() creates a buffer with the specified data. The data IS copied and MEMORY allocations are done. The buffer is not fixed and can be resized using buffer_reserve(). buffer: pointer to the buffer to put the data in data: the data to encapsulate in the buffer size: the size of the data ldns_buffer_clear() clears the buffer and make it ready for writing. The buffer's limit is set to the capacity and the position is set to 0. buffer: the buffer to clear ldns_buffer_printf() prints to the buffer, increasing the capacity if required using buffer_reserve(). The buffer's position is set to the terminating '\0' Returns the number of characters written (not including the terminating '\0') or -1 on failure. ldns_buffer_free() frees the buffer. *buffer: the buffer to be freed Returns void ldns_buffer_export() Makes the buffer fixed and returns a pointer to the data. The caller is responsible for free'ing the result. *buffer: the buffer to be exported Returns void AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_buffer. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 09:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy