Sponsored Content
Top Forums Programming AWK processing of a three-column file Post 302591775 by chrisjorg on Friday 20th of January 2012 02:37:39 PM
Old 01-20-2012
AWK processing of a three-column file

I have a 3-column data file, for which I wish to print certain parts of $3

Code:
PHI         PSI       A(x)
-177.5 -177.5 1.0625
-177.5 -172.5 0.55
-177.5  -167.5 0.0478125
-177.5 -162.5 0
-177.5 -157.5 0.284375
-177.5  -152.5 0.187188
-177.5 -147.5 0.236875
-177.5 -142.5 0.383438
-177.5  -137.5 0.720938
-177.5 -132.5 1.11906
-177.5 -127.5 1.47406
-177.5  -122.5 1.61094
-177.5 -117.5 1.81344
-177.5 -112.5 1.96156
-177.5  -107.5 2.11969
-177.5 -102.5 2.23438
-177.5 -97.5 2.38438
-177.5  -92.5 2.53969
-177.5 -87.5 2.46938
-177.5 -82.5 2.64406
-177.5  -77.5 2.84781
-177.5 -72.5 2.79375
-177.5 -67.5 3.25781
-177.5  -62.5 3.48031
-177.5 -57.5 3.975
-177.5 -52.5 4.30406
-177.5  -47.5 4.79688
-177.5 -42.5 5.21844
-177.5 -37.5 5.88375
-177.5  -32.5 6.56906
-177.5 -27.5 7.15531
-177.5 -22.5 7.75125
-177.5  -17.5 8.38563
-177.5 -12.5 8.92563
-177.5 -7.5 9.37313
-177.5  -2.5 9.9325
-177.5 2.5 10.6044
-177.5 7.5 10.6159

...
until +180


I want to access a certain range of the data, e.g. print $3 when the following conditions are met:
PHI 50 to 100 and PSI -70 to -90

which would give the following data:
Code:
52.5 -87.5  4.61531
52.5 -82.5 4.59969
52.5 -77.5 4.45344
52.5 -72.5 4.245

57.5  -87.5 4.24344
57.5 -82.5 4.0775
57.5 -77.5 3.90438
57.5 -72.5  3.86375

62.5 -87.5 3.84125
62.5 -82.5 3.76875
62.5 -77.5  3.63406
62.5 -72.5 3.39844

67.5 -87.5 3.73563
67.5 -82.5  3.65938
67.5 -77.5 3.60906
67.5 -72.5 3.31

72.5 -87.5  3.73688
72.5 -82.5 3.61813
72.5 -77.5 3.45938
72.5 -72.5  3.27969

77.5 -87.5 4.01219
77.5 -82.5 3.61063
77.5 -77.5  3.555
77.5 -72.5 3.43531

82.5 -87.5 4.32906
82.5 -82.5  4.00188
82.5 -77.5 3.83781
82.5 -72.5 4.08438

87.5 -87.5  4.89344
87.5 -82.5 4.60594
87.5 -77.5 4.6525
87.5 -72.5 4.54781

92.5  -87.5 5.455
92.5 -82.5 5.32375
92.5 -77.5 5.18188
92.5 -72.5  5.35219

97.5 -87.5 6.19656
97.5 -82.5 6.05938
97.5 -77.5  6.01063
97.5 -72.5 6.30094

Then I want to post-process this data
Any help here?

Last edited by chrisjorg; 01-20-2012 at 03:46 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

processing a file with sed and awk

Hello, I have what is probably a simple task in text manipulation, but I just can't wrap my brain around it. I have a text file that looks something like the following. Note that some have middle initials in the first field and some don't. john.r.smith:john.smith@yahoo.com... (4 Replies)
Discussion started by: manouche
4 Replies

2. Shell Programming and Scripting

AWK processing -numbers to another column

Hi Guys, I'm trying to clean up my home logger file and can't seem to work this out. Here is my data: 10-19-2009 08:39 00.2 00.0 00.7 01.1 49.1 0.0 11.9 270.1 -49.1 220.9 10-19-2009 08:40 00.2 00.0 00.7 00.7 49.1 0.0 171.9 171.9 49.1 220.9 10-19-2009 08:41 00.1 00.0 00.7 00.8 24.5 0.0... (2 Replies)
Discussion started by: BeJay
2 Replies

3. Shell Programming and Scripting

awk help in processing file.

I am trying to process file which has following data #23456789012345 ACNASPSA13N0N0 ACNAPCPA05N0N0 ACNAFATS11N0N0 I want to take out each line from the file and what to put in the file by name which if part of the line starting from offset 10 to 15. It means I want to create three file... (3 Replies)
Discussion started by: ekb
3 Replies

4. Shell Programming and Scripting

Help with File Processing (AWK)

Input File: 1234, 2345,abc 1,24141,gw 222,rff,sds 2232145,sdsd,121 Output file to be generated: 000001234,2345,abc 000000001,24141,gw 000000222,rff,sds 002232145,sdsd,121 i.e; the first column is padded to get 9 digits. I tried with following: (1 Reply)
Discussion started by: karumudi7
1 Replies

5. Shell Programming and Scripting

Help with File Processing (AWK)

Input File: 1234, 2345,abc 1,24141,gw 222,rff,sds 2232145,sdsd,121 Output file to be generated: 000001234,2345,abc 000000001,24141,gw 000000222,rff,sds 002232145,sdsd,121 i.e; the first column is padded to get 9 digits. I tried with following: (3 Replies)
Discussion started by: karumudi7
3 Replies

6. Shell Programming and Scripting

Help with File processing - Extracting the column

I have a line from table space report: 5 135_TT ms Normal 1774336.0 1774208.0 761152.0 1013056.0 57.1% Now I have to get 1013056.0 as o/p. For this I tried cut -f32 -d" " previously it worked now it is showing empty space. Suggest me the best code for this which... (1 Reply)
Discussion started by: karumudi7
1 Replies

7. Shell Programming and Scripting

Awk: Need help replacing a specific column in a file by part of a column in another file

Hi, I have two input files as File1 : ABC:client1:project1 XYZ:client2-aa:project2 DEF:client4:proj File2 : client1:W-170:xx client2-aa:WT-04:yy client4:L-005A:zz Also, array of valid values can be hardcoded like Output : ABC:W:project1 XYZ:WT:project2 (1 Reply)
Discussion started by: aa2601
1 Replies

8. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

9. Shell Programming and Scripting

Help with file processing using awk

hello All, I'm new to AWK programming and learned myself few things to process a file and deal with duplicate lines, but I got into a scenario which makes me clueless to handle. Here is the scenario.. Input file: user role ----- ---- AAA add AAA delete BBB delete CCC delete DDD ... (10 Replies)
Discussion started by: julearn
10 Replies

10. Shell Programming and Scripting

Processing a formatted file with awk

Hi - I want to interrogate information about my poker hands, sessions are all recorded in a text file in a particular format. Each hand starts with the string <PokerStars> followed by a unique hand reference and other data like date/time. There is then all the information about each hand. My first... (5 Replies)
Discussion started by: rbeech23
5 Replies
ASCII(7)					       BSD Miscellaneous Information Manual						  ASCII(7)

NAME
ascii -- octal, hexadecimal and decimal ASCII character sets DESCRIPTION
The octal set: 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel 010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 so 017 si 020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb 030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us 040 sp 041 ! 042 " 043 # 044 $ 045 % 046 & 047 ' 050 ( 051 ) 052 * 053 + 054 , 055 - 056 . 057 / 060 0 061 1 062 2 063 3 064 4 065 5 066 6 067 7 070 8 071 9 072 : 073 ; 074 < 075 = 076 > 077 ? 100 @ 101 A 102 B 103 C 104 D 105 E 106 F 107 G 110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O 120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W 130 X 131 Y 132 Z 133 [ 134 135 ] 136 ^ 137 _ 140 ` 141 a 142 b 143 c 144 d 145 e 146 f 147 g 150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o 160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w 170 x 171 y 172 z 173 { 174 | 175 } 176 ~ 177 del The hexadecimal set: 00 nul 01 soh 02 stx 03 etx 04 eot 05 enq 06 ack 07 bel 08 bs 09 ht 0a nl 0b vt 0c np 0d cr 0e so 0f si 10 dle 11 dc1 12 dc2 13 dc3 14 dc4 15 nak 16 syn 17 etb 18 can 19 em 1a sub 1b esc 1c fs 1d gs 1e rs 1f us 20 sp 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2a * 2b + 2c , 2d - 2e . 2f / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3a : 3b ; 3c < 3d = 3e > 3f ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4a J 4b K 4c L 4d M 4e N 4f O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5a Z 5b [ 5c 5d ] 5e ^ 5f _ 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6a j 6b k 6c l 6d m 6e n 6f o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7a z 7b { 7c | 7d } 7e ~ 7f del The decimal set: 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us 32 sp 33 ! 34 " 35 # 36 $ 37 % 38 & 39 ' 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 / 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ? 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z 91 [ 92 93 ] 94 ^ 95 _ 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w 120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 del FILES
/usr/share/misc/ascii HISTORY
An ascii manual page appeared in Version 7 AT&T UNIX. BSD
June 5, 1993 BSD
All times are GMT -4. The time now is 09:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy