Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Please help to fix awk script Post 302794977 by snysmumrik on Wednesday 17th of April 2013 04:48:47 AM
Old 04-17-2013
Thanks. One last thing - I have a multiple enteries in file -
Code:
timestep       500        25         0         3    0.001000    0.500000
       20.0000000000        0.0000000000        0.0000000000
       -0.0000000017       20.0000000000        0.0000000000
       -0.0000000017       -0.0000000017       20.0000000000
CT_1             1   12.011000   -0.019000    0.640298
    0.9849963161E-01    -3.415112416         1.363374178
HC               2    1.008000    0.080000    1.479956
   -0.2121662555        -3.863455405        0.3080721923
HC               3    1.008000    0.080000    1.523069
    -1.497545961        -4.274924074         2.443930026
HC               4    1.008000    0.080000    1.333436
   -0.2046782675E-01    -3.884045345         3.393900210
HC               5    1.008000    0.080000    0.475593
    0.6645083761E-01    -5.274859543         2.207872210
HC               6    1.008000    0.080000    2.148578
     2.012043588        -4.255526008         1.282247861
HC               7    1.008000    0.080000    2.318435
     2.030435317        -2.972730305         2.435165857
HC               8    1.008000    0.080000    2.579209
     1.986543784        -2.614081904        0.6651575328
HC               9    1.008000    0.080000    2.835455
    -4.516000060       -0.6390584439        0.1821449846
HC              10    1.008000    0.080000    2.900618
    -3.847187217        -2.017469231       -0.6873319288
HC              11    1.008000    0.080000    3.014232
    -4.558244417       -0.6516313832        -1.645346738
CT_2            12   12.011000   -0.240000    2.414372
    -4.027556611       -0.9305956823       -0.7567879539
CT_2            13   12.011000   -0.240000    1.889602
     1.660000184        -3.278731061         1.464017002
CT_2            14   12.011000   -0.240000    0.463260
   -0.3736403707        -4.330624723         2.450383850
C               15   12.011000    0.569000    0.560350
   -0.5366914029        -1.980928569         1.574219882
O               16   15.999000   -0.570000    1.607385
   -0.4278922248        -1.357753029         2.570890083
N               17   14.007000   -0.730000    0.140561
    -1.208805366        -1.532235679        0.5673463632
H               18    1.008000    0.370000    0.907631
    -1.136311398        -2.139234863       -0.2786154629
CT_3            19   12.011000    0.140000    0.388223
    -1.903616044       -0.2739084042        0.4907961156
CT_4            20   12.011000    0.200000    0.889058
    -2.713660887       -0.1945789844       -0.8233791846
H1              21    1.008000    0.080000    1.790695
    -2.144431000       -0.6193961442        -1.696199396
H1              22    1.008000    0.080000    1.251414
    -1.113333313        0.4597479795        0.4873591014
H1              23    1.008000    0.080000    1.401424
    -2.605232776       -0.2539148024         1.355851660
OH              24   15.999000   -0.680000    0.170902
    -2.883721417         1.170430901        -1.063007617
HO              25    1.008000    0.400000    0.802468
    -3.755698183         1.390412071       -0.7269985042
timestep      1500        25         0         3    0.001000    1.500000
       20.0000000000        0.0000000000        0.0000000000
       -0.0000000017       20.0000000000        0.0000000000
       -0.0000000017       -0.0000000017       20.0000000000
CT_1             1   12.011000   -0.019000    1.108827
    0.5930813433        -3.059647383        0.9093170534
HC               2    1.008000    0.080000    1.035396
    0.4325261101        -2.863254539         1.968758844
HC               3    1.008000    0.080000    4.510480
     1.943889135        -1.400824972        0.4446815567
HC               4    1.008000    0.080000    5.038050
     1.997587984        -2.723903724       -0.6330481166
HC               5    1.008000    0.080000    3.495500
     2.776704671        -2.790314949        0.9971734449
HC               6    1.008000    0.080000    2.646696
     1.303777680        -5.015186286         1.216356852
HC               7    1.008000    0.080000    4.899226
    0.5444482658        -4.839385307       -0.3926739911
HC               8    1.008000    0.080000    4.126721
   -0.3351590642        -4.945216690         1.087335425
HC               9    1.008000    0.080000    5.025144
    -2.335162001         1.703747125         1.766118970
HC              10    1.008000    0.080000    5.259478
    -1.485614704        0.5232332483         2.667235397
HC              11    1.008000    0.080000    6.747800
    -3.119713679         1.071097349         3.299766915
CT_2            12   12.011000   -0.240000    4.989691
    -2.493930014        0.8599303479         2.445446594
CT_2            13   12.011000   -0.240000    3.045725
    0.5382711509        -4.518100324        0.7268131019
CT_2            14   12.011000   -0.240000    3.428692
     1.873711712        -2.498659898        0.4361924427
C               15   12.011000    0.569000    1.644059
   -0.6081926085        -2.279925921        0.1863969525
O               16   15.999000   -0.570000    3.887154
   -0.7777844810        -2.458871627        -1.043373240
N               17   14.007000   -0.730000    0.487297
    -1.381080530        -1.599443295        0.9939790523
H               18    1.008000    0.370000    2.277922
    -1.248085227        -1.605021545         2.010060279
CT_3            19   12.011000    0.140000    0.355424
    -2.357481513       -0.7177380924        0.4916404910
CT_4            20   12.011000    0.200000    2.979709
    -3.243082218       -0.1626320330         1.574424959
H1              21    1.008000    0.080000    4.505487
    -3.471572515       -0.9883864713         2.248890966

And now it is stucking them all in one, what will be the best way to display separatly each frame(starting from timestep) and setting natom to 1 each new frame. Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk / shell - Fix broken lines and data

Gurus, I am struggling with a issue and thought I could use some of your expertise. Need Help with this I have a flat file that has millions of records 24|john|account ~ info |56| 25|kuo|account ~ journal |58| 27|kim|account ~ journal |59| 28|San|account ~ journal |60|... (3 Replies)
Discussion started by: rimss
3 Replies

2. Shell Programming and Scripting

fix a problem in this script

z=9 i=0 h=02 min=55 while do cat /home/barmecha/test | grep $h:$min >> /home/barmecha/file1 min=`expr $min + 1` if ; then h=`expr $h + 1` fi i=`expr $i + 1` done i have a log file with time wise log in it, this script help me to pull out logs of the give time interval...but the... (8 Replies)
Discussion started by: abhishek27
8 Replies

3. Shell Programming and Scripting

AWK record length fix

Hi Friends, Need some help in AWK. Working on AIX 5 Have been trying the following functionality to make the record length fixed: if( length(record) < 300 ) { printf("%-300s\n", record); } In my opinion it will apply some fillers in the end. Its is not making any... (4 Replies)
Discussion started by: kanu_pathak
4 Replies

4. Shell Programming and Scripting

how to fix this awk script?

i have a log file while looks like this ++ user_a blabla blabla nas_b blabla user_d this is a user_a junk line another junk line user_c nas_m blabla ++ basically most of the lines contain a "user" keywords, and the rest of the lines do not have "user" at all. So I have the... (17 Replies)
Discussion started by: fedora
17 Replies

5. Shell Programming and Scripting

how to fix the column length in a file using Awk Prog

Hi I use the following code to read the file and to fix the length of the column of the record in the file 'Sample.txt' ls Samp* | awk ' { a=$1 } END{ FS="n" for(i=1;i<=NR;i++) { while( getline < a ) { f1=$0; print("Line::",f1); f2=substr(f1,1,10) print("Field1::",f2);... (10 Replies)
Discussion started by: meva
10 Replies

6. Shell Programming and Scripting

How to fix this awk

I have a script which will mask the 9th and 15th column in a record starting with BPR. The record looks like below before my script BPR*C*160860.04*C*ACH*CTX*01*072000326*DA*1548843*3006968523**01*071000013*DA*5529085*100323*VEN The record will be masked after my script parses this... (19 Replies)
Discussion started by: Muthuraj K
19 Replies

7. Shell Programming and Scripting

Fix timestamp with Sed or Awk

Hi I am dealing with the following string: Date: Thur, 13 March 2011 01:01:10 +0000 I asked for help in another topic that converted a similar string: Date: Thur, 13 March 2011 9:50 AM To a 24 hr standard. The problem is that it comes out as: Date: Thur, 13 March 2011 9:50:00 +0000... (4 Replies)
Discussion started by: duonut
4 Replies

8. Shell Programming and Scripting

My script failed and can't fix it ?

Hi , I'd like to give you a little bit idea about my script which is used to get any generated file from remote server using ftp session then organized those file into directories based on their date ( at the end I supposed to have 1 months directories 20130401 20130402 ....20130430 ,... (27 Replies)
Discussion started by: arm
27 Replies

9. Shell Programming and Scripting

awk if condition match and fix print decimal place

Hi All, I have problem in the middle of implementing to users, whereby the complaint is all about the decimal place which is too long. I need two decimal places only, but the outcome from command is always fixed to 6. See the sample : before: Sort Total Site Sort SortName Parts ... (3 Replies)
Discussion started by: horsepower
3 Replies

10. UNIX for Dummies Questions & Answers

awk file subtracted by a fix value - conditioned

Hi all... i have been trying to make this work but I have been failing for 6 hours .. I know it should be something simple that I am missing to it would be great if you can help me ... I want to subtract a fixed value (lets set 1) from any value >=1 from the whole file my file looks like ... (4 Replies)
Discussion started by: A-V
4 Replies
All times are GMT -4. The time now is 12:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy