need help for a script to organize data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help for a script to organize data
# 1  
Old 08-11-2011
need help for a script to organize data

Hey all,

I have a file with info like this

Code:
12:05:44 DEV001       (15F6)     71      5    1372     131  58 100    6   0     17
         DEV002       (15FA)     60      0     928      15  50 N/A    2 N/A      5
         DEV003       (15FE)     77      2     961      59  51 100    1   0      2
         DEV004       (1602)     62     15     970     135  53 100    6   0     51
         DEV031       (20EE)     59     14    1076     436  53 100    5   0      4
         DEV032       (20F2)     54     42    1451     680  52 100    9   0      0
         DEV033       (20F6)     55     10    2582     416  58 100   15   0      2
                              ------ ------ ------ ------ --- ---  --- --- ------
Total                           2034    389  36735   9808  56 100    5   0   2249


12:06:23 DEV001       (15F6)     79     12    3188     599  56 100   14   0     70
         DEV002       (15FA)     48     10     458     444  48 100    4   0      0
         DEV032       (20F2)     51     11     705     282  49 100    4   0    302
         DEV033       (20F6)     47      7     538     201  55 100    4   0    165
                              ------ ------ ------ ------ --- ---  --- --- ------
Total                           1610    394  23407  11798  50  99    4   0   1808

Would need some help in reorganizing the data so that I can get the output like this :-

Code:
12:05:44                          2034    389  36735   9808  56 100    5   0   2249
12:06:23                          1610    394  23407  11798  50  99    4   0   1808

The output should display the time and total field associated with it..

Any help would be much appreciated..
# 2  
Old 08-11-2011
Try:
Code:
awk 'NF>11{t=$1}/Total/{$1=t"\t\t";print}' file

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 08-11-2011
perfect ..Thanks a lot...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Organize output with awk

Hello, maybe someone could help me with this. I'm trying to print in a more ordered way this input. the input file is: AB XY UT ZW PRAT 0 3 4 7214800 93 0 3 4 730770 ... (8 Replies)
Discussion started by: Ophiuchus
8 Replies

2. Shell Programming and Scripting

Is there a way to organize bash_profile across different platforms

I want to have one .bash_profile works on multiple platform, ubuntu, debian, redhat, cygwin, osx. So how should I organize .bash_profile? It can be multiple files in some subdir Let me brief you: what i want is a way to organize bash_profile across platforms so I can use one set of profiles... (2 Replies)
Discussion started by: John_Peter
2 Replies

3. Shell Programming and Scripting

Discover unique names and organize

I'm attempting to write a script that will look into a directory, discover all unique names, create directories for their prefix names and place the files inside. I do this now one by one with a simple script but I'd like to automate the process. The directory would contain something like: ... (6 Replies)
Discussion started by: scribling
6 Replies

4. Shell Programming and Scripting

Organize file according to their extension

Hi Everyone ! i want to make an application which is written in shell script and in Bourne shell (sh) i want, when my script is executed, it read all the files in the directly and move them to folders according to their extension. suppose i have a files: test.txt test.jpg test.docx... (1 Reply)
Discussion started by: me_newbie
1 Replies

5. Shell Programming and Scripting

Help with re-organize data by adding "-" in empty place

Input file data_1 data_2 A B C data_1 data_2 B D data_1 data_2 A C data_1 data_2 A data_1 data_2 B C data_1 data_2 C data_1 data_2 A B data_1 data_2 data_1 data_2 C B A . . Output file data_1 data_2 A B C data_1 data_2 - B D data_1 data_2 A - C (3 Replies)
Discussion started by: perl_beginner
3 Replies

6. UNIX and Linux Applications

Organize (pretty) code

I'm looking for terminal programs, which organize and pretty code like HTML or JavaScript. Thanks! ---------- Post updated at 07:01 AM ---------- Previous update was at 01:49 AM ---------- Found this Online javascript beautifier (1 Reply)
Discussion started by: borobudur
1 Replies

7. Shell Programming and Scripting

Organize of Data

Hello Expert, I am new in awk. I would like to know how to arrange data like Input File: lpar1 1 2 3 4 5 6 lpar10 4 5 6 lpar3 4 5 (3 Replies)
Discussion started by: shah09
3 Replies

8. Shell Programming and Scripting

how organize my log file ( tabs )

hello i have written a multitask script which performs verifications on the server (RHEL 5 tikanga); based on list of rules. since the results are huge both in length and number and I am sending them all to my log file. Is there any method to organize the STATUS of my results in a defined... (1 Reply)
Discussion started by: goswami.c
1 Replies

9. Shell Programming and Scripting

Need assistance with simple shell script to organize files. [Code attached]

I need some help with this shell script for class. All it does is organize your files. It works, but in the log file, it needs to show the new filepaths of the moved files. Heres my log of my output: Starting to organize... movie2.wmv --> movie3.mov --> movie1.mpg --> song1.mp3 --> ... (3 Replies)
Discussion started by: ryandamartini
3 Replies

10. UNIX for Dummies Questions & Answers

How do I organize a series of files in date order?

I'd like to ls a group of files in date order but I'm not sure what the commands would be. Can anyone help with this? (1 Reply)
Discussion started by: hedgehog001
1 Replies
Login or Register to Ask a Question