03-25-2010
formatting data file with awk or sed
Hi,
I have a (quite large) data file which looks like:
_____________
header part..
more header part..
x1 x2 x3 x4 x5 x6
x7 x8 x9 x10 x11 x12
x13 ...
... x59 x60
y1 y2 y3 y4...
... y100
______________
where x1, x2,...,x60 and y1, y2,...y100 are numbers of 10 digits (so each line contains 10x6 numbers +5 spaces: 65 characters).
The header spans 80 lines. The real data starts at line 81.
I would like to have an output like this:
______________
x1 y1
x1 y2
x1 y3
x1 y4
...
x2 y1
x2 y2
x2 y3
...
...
x60 y98
x60 y99
x60 y100
______________
Can anybody tell me how can I get it? Maybe using sed, awk, or perl?
Any help would be much appreciated!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello Shell Gurus i need help in solving this puzzle. We have a junk data file that needs to be fed into the database. Need to clense the data file thru shell script. I am not a expert and so need help with
Here is what i need to do on the input file
-Step -1 Replace all pipes ‘|' within... (1 Reply)
Discussion started by: rimss
1 Replies
2. Shell Programming and Scripting
Morning guys. Another day another question. :rolleyes:
I am knocking up a script to pull some data from a file. The problem is the file is very big (up to 1 gig in size), so this solution:
for results in `grep "^\
... works, but takes ages (we're talking minutes) to run. The data is held... (8 Replies)
Discussion started by: dlam
8 Replies
3. Shell Programming and Scripting
Hello - is there any way in awk I can do...
4861 x(1) y(1) z(1)
4959 x(1) y(1) z(1)
5007 x(1) y(1) z(1)
4861 x(2) y(2) z(2)
4959 x(2) y(2) z(2)
5007 x(2) y(2) z(2)
4861 x(3) y(3) z(3)
4959 x(3) y(3) z(3)
5007 x(3) y(3) z(3)
to become...
4861 x(1) y(1) z(1) 4861 x(2) y(2) z(2)... (3 Replies)
Discussion started by: catwoman
3 Replies
4. Shell Programming and Scripting
Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result :
mon titre 1;Createur1;Dossier1
mon titre 1;Createur1;Dossier1
and save it in cvs file (fichier.cvs).
FROM this Xml file (test.xml):
<playlist version="1">
<trackList>
<track>... (1 Reply)
Discussion started by: yeclota
1 Replies
5. Shell Programming and Scripting
I am executing the following command:
sort file1.txt | uniq -c | sort -n > file2.txt
The problem is that in file 2, I get leading spaces, Like so:
1 N/A|A8MW11
8 N/A|ufwo1
9 N/A|a8mw11
10 900003|smoketest297688
10 N/A|a9dg4
10 danny|danni
12... (5 Replies)
Discussion started by: ddurden7
5 Replies
6. Shell Programming and Scripting
I have a binary (hex) file I need to parse to get some data which are encoded this way:
.* b4 . . . 01 12 .* af .* 83 L1 x1 x2 xL 84 L2 y1 y2 yL
By another words there is a stream of hexadecimal bytes (in my example separated by space for better readability). I need to get value stored in... (3 Replies)
Discussion started by: sameucho
3 Replies
7. Shell Programming and Scripting
Hi All,
Need an urgent help to convert a unix file in to a particular format:
**source file:**
1111111
2d2f2h2
3dfgsd3
...........
1111111 <-- repeats in every nth line. remaining all lines will be different
123ss41
432ff45
...........
1111111 <-- repetition
qwe1234
123weq3... (1 Reply)
Discussion started by: rajivnairfis
1 Replies
8. Shell Programming and Scripting
Hi everyone,
I am trying to write a bash script which reads a data file and does some algebraic operations.
here is the structure of data.xml file that I have;
1 <data>
2 .
3 .
4 .
5 </data>
6 <data>
7 .
8 .
9 .
10</data>
etc.
Each data block contains same number of lines (say... (4 Replies)
Discussion started by: hayreter
4 Replies
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
I have a file like this :
! 1 ! 542255 ! 50,140.00 !
! 2 ! 551717 ! 5,805.00 !
! 3 ! 551763 ! 8,130.00 !
! 4 ! 551779 ! 750.00 !
! 5 ! 551810 ! 56,580.00 !
! 6 ! 551816 ! 1,350.00 !
! 7 ! 551876 ! 360.00 !
! 8 ! 551898 ! ... (10 Replies)
Discussion started by: adam1969in
10 Replies
LEARN ABOUT OPENSOLARIS
libgdk-x11-2.0
libgdk-x11-2.0(3) C Library Functions libgdk-x11-2.0(3)
NAME
libgdk-x11-2.0 - GTK+ Drawing Kit API
DESCRIPTION
The libgdk-x11-2.0 library is an implementation of the GTK+ drawing kit for the X11 windowing system. It is used by GTK+ for low-level
drawing operations. Most applications will not use GDK directly, but will use GTK+ components (see libgtk-x11-2.0(3)).
To access the API documentation, you must install the developer version of the package.
FILES
The following files are used by this application:
/usr/lib/libgdk-x11-2.0.so GTK+ Drawing Kit API shared library
/usr/share/gtk-doc/html/gdk Location of developer documentation
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWgnome-base-libs SUNWg- |
| |nome-base-libs-64 |
+-----------------------------+-----------------------------+
|Interface stability |Committed |
+-----------------------------+-----------------------------+
SEE ALSO
libgdk_pixbuf-2.0(3), libglib-2.0(3), libgobject-2.0(3), libgtk-x11-2.0(3), attributes(5), gnome-interfaces(5), gnome-std-options(5),
X11(5)
NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2003, 2004, 2006
SunOS 5.11 31 Aug 2004 libgdk-x11-2.0(3)