Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort awk 1

Status
Not open for further replies.

malpa

Technical User
Feb 8, 2004
122
CO
Hi

Thanks

I want to do a control over files in a directory. In this directory are located a files from many switchs. I spend many time to review what files dont appeared.

My initial file is this:

where the secuence are located in substr($11,pos+2,length)
pos=8
length=4
the initial file is 9898, next is 9899

402166 296 -rw-r--r-- 1 osanchez consulta 289794 Nov 22 09:16 ./switch_9898220856.p00.Z
402173 296 -rw-r--r-- 1 osanchez consulta 287995 Nov 22 10:16 ./switch_9899220942.p00.Z
402194 304 -rw-r--r-- 1 osanchez consulta 295096 Nov 22 07:22 ./switch_9889211525.p00.Z
402195 304 -rw-r--r-- 1 osanchez consulta 295499 Nov 22 07:23 ./switch_9891211633.p00.Z
402196 296 -rw-r--r-- 1 osanchez consulta 292114 Nov 22 07:22 ./switch_9887211416.p00.Z
402197 296 -rw-r--r-- 1 osanchez consulta 293860 Nov 22 07:23 ./switch_9893211749.p00.Z
402198 296 -rw-r--r-- 1 osanchez consulta 288698 Nov 22 07:24 ./switch_9896212157.p00.Z
402199 304 -rw-r--r-- 1 osanchez consulta 295094 Nov 22 07:23 ./switch_9890211558.p00.Z
402200 296 -rw-r--r-- 1 osanchez consulta 290607 Nov 22 07:22 ./switch_9886211315.p00.Z
402201 304 -rw-r--r-- 1 osanchez consulta 296340 Nov 22 07:23 ./switch_9892211709.p00.Z
402202 296 -rw-r--r-- 1 osanchez consulta 292111 Nov 22 07:23 ./switch_9894211846.p00.Z
402203 296 -rw-r--r-- 1 osanchez consulta 292920 Nov 22 08:16 ./switch_9897220747.p00.Z
402204 296 -rw-r--r-- 1 osanchez consulta 289121 Nov 22 11:16 ./switch_9901221106.p00.Z
402205 296 -rw-r--r-- 1 osanchez consulta 288656 Nov 22 11:16 ./switch_9900221025.p00.Z
402206 296 -rw-r--r-- 1 osanchez consulta 288536 Nov 22 12:16 ./switch_9902221149.p00.Z
402207 296 -rw-r--r-- 1 osanchez consulta 288604 Nov 22 13:16 ./switch_9903221241.p00.Z
402208 296 -rw-r--r-- 1 osanchez consulta 287458 Nov 22 15:16 ./switch_9905221508.p00.Z
402209 296 -rw-r--r-- 1 osanchez consulta 289074 Nov 22 17:16 ./switch_9906221623.p00.Z
402210 288 -rw-r--r-- 1 osanchez consulta 285673 Nov 22 19:16 ./switch_9908221902.p00.Z
402211 288 -rw-r--r-- 1 osanchez consulta 285737 Nov 22 21:16 ./switch_9909222037.p00.Z
402212 296 -rw-r--r-- 1 osanchez consulta 287079 Nov 23 00:16 ./switch_9910230000.p00.Z
402213 296 -rw-r--r-- 1 osanchez consulta 287007 Nov 23 10:16 ./switch_9912231012.p00.Z
402215 296 -rw-r--r-- 1 osanchez consulta 287487 Nov 23 15:16 ./switch_9915231459.p00.Z
402216 288 -rw-r--r-- 1 osanchez consulta 285568 Nov 23 13:16 ./switch_9914231258.p00.Z
402217 296 -rw-r--r-- 1 osanchez consulta 289439 Nov 23 18:16 ./switch_9916231720.p00.Z
402218 296 -rw-r--r-- 1 osanchez consulta 290099 Nov 23 19:16 ./switch_9917231911.p00.Z
402219 296 -rw-r--r-- 1 osanchez consulta 290186 Nov 23 21:16 ./switch_9918232105.p00.Z
402220 296 -rw-r--r-- 1 osanchez consulta 291365 Nov 24 07:16 ./switch_9919240714.p00.Z
402222 304 -rw-r--r-- 1 osanchez consulta 295084 Nov 22 07:22 ./switch_9885211211.p00.Z
402223 296 -rw-r--r-- 1 osanchez consulta 294910 Nov 22 07:22 ./switch_9888211451.p00.Z
402224 296 -rw-r--r-- 1 osanchez consulta 289850 Nov 22 07:23 ./switch_9895212001.p00.Z
402225 296 -rw-r--r-- 1 osanchez consulta 292045 Nov 24 09:16 ./switch_9920240822.p00.Z
402226 296 -rw-r--r-- 1 osanchez consulta 292235 Nov 24 10:16 ./switch_9923240957.p00.Z
402227 296 -rw-r--r-- 1 osanchez consulta 293892 Nov 24 10:16 ./switch_9922240928.p00.Z
406048 304 -rw-r--r-- 1 osanchez consulta 295032 Nov 24 12:16 ./switch_9927241156.p00.Z
406051 296 -rw-r--r-- 1 osanchez consulta 292387 Nov 24 12:16 ./switch_9926241124.p00.Z
406052 304 -rw-r--r-- 1 osanchez consulta 295263 Nov 24 11:16 ./switch_9925241055.p00.Z
406053 296 -rw-r--r-- 1 osanchez consulta 292312 Nov 24 13:16 ./switch_9928241249.p00.Z
406054 296 -rw-r--r-- 1 osanchez consulta 289819 Nov 24 14:16 ./switch_9929241401.p00.Z
406055 296 -rw-r--r-- 1 osanchez consulta 293869 Nov 24 15:16 ./switch_9931241513.p00.Z
406056 296 -rw-r--r-- 1 osanchez consulta 294460 Nov 24 15:16 ./switch_9930241440.p00.Z
406057 296 -rw-r--r-- 1 osanchez consulta 294526 Nov 24 17:16 ./switch_9933241618.p00.Z
406058 296 -rw-r--r-- 1 osanchez consulta 293929 Nov 24 17:16 ./switch_9934241653.p00.Z
406059 304 -rw-r--r-- 1 osanchez consulta 296793 Nov 24 18:16 ./switch_9935241731.p00.Z
406060 296 -rw-r--r-- 1 osanchez consulta 294783 Nov 24 16:16 ./switch_9932241545.p00.Z
406061 296 -rw-r--r-- 1 osanchez consulta 294082 Nov 24 19:16 ./switch_9936241817.p00.Z
406062 296 -rw-r--r-- 1 osanchez consulta 292212 Nov 24 20:16 ./switch_9937241928.p00.Z
406063 296 -rw-r--r-- 1 osanchez consulta 291342 Nov 24 21:16 ./switch_9938242059.p00.Z
406064 296 -rw-r--r-- 1 osanchez consulta 292074 Nov 25 09:16 ./switch_9940250822.p00.Z
406065 296 -rw-r--r-- 1 osanchez consulta 292273 Nov 25 09:16 ./switch_9941250859.p00.Z
406066 296 -rw-r--r-- 1 osanchez consulta 293287 Nov 25 10:16 ./switch_9943251000.p00.Z
406067 296 -rw-r--r-- 1 osanchez consulta 287702 Nov 22 14:16 ./switch_9904221353.p00.Z
406068 288 -rw-r--r-- 1 osanchez consulta 286422 Nov 22 18:16 ./switch_9907221742.p00.Z
406069 296 -rw-r--r-- 1 osanchez consulta 291940 Nov 25 12:16 ./switch_9947251202.p00.Z
406070 296 -rw-r--r-- 1 osanchez consulta 292582 Nov 25 11:16 ./switch_9944251029.p00.Z
406071 296 -rw-r--r-- 1 osanchez consulta 293073 Nov 25 11:16 ./switch_9945251059.p00.Z
406072 296 -rw-r--r-- 1 osanchez consulta 289994 Nov 25 14:16 ./switch_9949251408.p00.Z
406073 296 -rw-r--r-- 1 osanchez consulta 289392 Nov 25 13:16 ./switch_9948251300.p00.Z
406074 296 -rw-r--r-- 1 osanchez consulta 291634 Nov 25 12:16 ./switch_9946251128.p00.Z
406075 296 -rw-r--r-- 1 osanchez consulta 292181 Nov 25 15:16 ./switch_9950251444.p00.Z
406076 296 -rw-r--r-- 1 osanchez consulta 292806 Nov 25 16:16 ./switch_9951251517.p00.Z
406077 296 -rw-r--r-- 1 osanchez consulta 292696 Nov 25 16:16 ./switch_9952251550.p00.Z
406078 296 -rw-r--r-- 1 osanchez consulta 294131 Nov 25 18:16 ./switch_9955251739.p00.Z
406079 296 -rw-r--r-- 1 osanchez consulta 292451 Nov 25 17:16 ./switch_9953251624.p00.Z
406080 296 -rw-r--r-- 1 osanchez consulta 293830 Nov 25 17:16 ./switch_9954251700.p00.Z
406081 296 -rw-r--r-- 1 osanchez consulta 292038 Nov 25 19:16 ./switch_9956251835.p00.Z
406082 296 -rw-r--r-- 1 osanchez consulta 288189 Nov 25 20:16 ./switch_9957251947.p00.Z
406083 296 -rw-r--r-- 1 osanchez consulta 290943 Nov 25 22:16 ./switch_9958252135.p00.Z
406084 296 -rw-r--r-- 1 osanchez consulta 290439 Nov 26 08:16 ./switch_9959260730.p00.Z
406085 296 -rw-r--r-- 1 osanchez consulta 293544 Nov 26 10:16 ./switch_9963261006.p00.Z
406086 296 -rw-r--r-- 1 osanchez consulta 293597 Nov 26 10:16 ./switch_9962260937.p00.Z
406087 296 -rw-r--r-- 1 osanchez consulta 291698 Nov 26 09:16 ./switch_9960260830.p00.Z
406088 296 -rw-r--r-- 1 osanchez consulta 291895 Nov 26 09:16 ./switch_9961260906.p00.Z
406089 288 -rw-r--r-- 1 osanchez consulta 285267 Nov 23 09:16 ./switch_9911230844.p00.Z
406090 288 -rw-r--r-- 1 osanchez consulta 285026 Nov 23 12:16 ./switch_9913231130.p00.Z
406091 296 -rw-r--r-- 1 osanchez consulta 291943 Nov 26 17:04 ./switch_9973261634.p00.Z
406092 304 -rw-r--r-- 1 osanchez consulta 295381 Nov 26 17:02 ./switch_9966261136.p00.Z
406093 296 -rw-r--r-- 1 osanchez consulta 291036 Nov 26 17:03 ./switch_9968261317.p00.Z
406094 296 -rw-r--r-- 1 osanchez consulta 294137 Nov 26 17:03 ./switch_9967261212.p00.Z
406095 296 -rw-r--r-- 1 osanchez consulta 291948 Nov 26 17:03 ./switch_9969261418.p00.Z
406096 296 -rw-r--r-- 1 osanchez consulta 294494 Nov 26 17:03 ./switch_9970261454.p00.Z
406097 304 -rw-r--r-- 1 osanchez consulta 295584 Nov 26 17:03 ./switch_9971261527.p00.Z
406098 296 -rw-r--r-- 1 osanchez consulta 293550 Nov 26 19:03 ./switch_9976261851.p00.Z
406099 304 -rw-r--r-- 1 osanchez consulta 297382 Nov 26 18:01 ./switch_9974261711.p00.Z
406100 304 -rw-r--r-- 1 osanchez consulta 295375 Nov 26 18:01 ./switch_9975261753.p00.Z
406101 296 -rw-r--r-- 1 osanchez consulta 291884 Nov 26 21:02 ./switch_9977262009.p00.Z
406102 296 -rw-r--r-- 1 osanchez consulta 292115 Nov 26 23:02 ./switch_9978262242.p00.Z
406103 296 -rw-r--r-- 1 osanchez consulta 290744 Nov 27 08:02 ./switch_9979270754.p00.Z
406104 296 -rw-r--r-- 1 osanchez consulta 292810 Nov 25 07:16 ./switch_9939250656.p00.Z
406105 296 -rw-r--r-- 1 osanchez consulta 293851 Nov 24 09:16 ./switch_9921240857.p00.Z
406106 296 -rw-r--r-- 1 osanchez consulta 292272 Nov 24 11:16 ./switch_9924241026.p00.Z
406107 296 -rw-r--r-- 1 osanchez consulta 294826 Nov 27 09:02 ./switch_9980270842.p00.Z
406108 296 -rw-r--r-- 1 osanchez consulta 288434 Nov 29 11:01 ./switch_0022291002.p00.Z
406109 296 -rw-r--r-- 1 osanchez consulta 292530 Nov 27 11:02 ./switch_9983271017.p00.Z
406110 296 -rw-r--r-- 1 osanchez consulta 294023 Nov 27 11:02 ./switch_9984271046.p00.Z
406111 296 -rw-r--r-- 1 osanchez consulta 292887 Nov 27 13:01 ./switch_9987271233.p00.Z
406112 296 -rw-r--r-- 1 osanchez consulta 293949 Nov 27 12:02 ./switch_9986271148.p00.Z
406113 296 -rw-r--r-- 1 osanchez consulta 293978 Nov 27 12:01 ./switch_9985271117.p00.Z
406114 288 -rw-r--r-- 1 osanchez consulta 286118 Nov 27 14:01 ./switch_9988271344.p00.Z
406115 296 -rw-r--r-- 1 osanchez consulta 293753 Nov 27 16:01 ./switch_9990271505.p00.Z
406116 296 -rw-r--r-- 1 osanchez consulta 293978 Nov 27 15:01 ./switch_9989271430.p00.Z
406117 304 -rw-r--r-- 1 osanchez consulta 295271 Nov 27 17:01 ./switch_9992271612.p00.Z
406118 296 -rw-r--r-- 1 osanchez consulta 294228 Nov 27 16:01 ./switch_9991271538.p00.Z
406119 296 -rw-r--r-- 1 osanchez consulta 294833 Nov 27 17:01 ./switch_9993271647.p00.Z
406120 304 -rw-r--r-- 1 osanchez consulta 296026 Nov 27 18:01 ./switch_9994271724.p00.Z
406121 296 -rw-r--r-- 1 osanchez consulta 292381 Nov 27 19:01 ./switch_9995271809.p00.Z
406122 296 -rw-r--r-- 1 osanchez consulta 289910 Nov 27 21:01 ./switch_9997272035.p00.Z
406123 296 -rw-r--r-- 1 osanchez consulta 291587 Nov 27 20:01 ./switch_9996271914.p00.Z
406124 296 -rw-r--r-- 1 osanchez consulta 292216 Nov 28 03:01 ./switch_9998280218.p00.Z
406125 296 -rw-r--r-- 1 osanchez consulta 293156 Nov 28 09:01 ./switch_0000280845.p00.Z
406126 296 -rw-r--r-- 1 osanchez consulta 288841 Nov 28 08:01 ./switch_9999280801.p00.Z
406127 296 -rw-r--r-- 1 osanchez consulta 291493 Nov 25 10:16 ./switch_9942250930.p00.Z
406128 296 -rw-r--r-- 1 osanchez consulta 294102 Nov 28 10:02 ./switch_0002280949.p00.Z
406129 296 -rw-r--r-- 1 osanchez consulta 293682 Nov 28 12:02 ./switch_0006281149.p00.Z
406130 296 -rw-r--r-- 1 osanchez consulta 293410 Nov 28 12:01 ./switch_0005281119.p00.Z
406131 296 -rw-r--r-- 1 osanchez consulta 294908 Nov 28 11:02 ./switch_0004281049.p00.Z
406132 296 -rw-r--r-- 1 osanchez consulta 293706 Nov 28 11:02 ./switch_0003281018.p00.Z
406133 296 -rw-r--r-- 1 osanchez consulta 291059 Nov 28 13:01 ./switch_0007281232.p00.Z
406134 296 -rw-r--r-- 1 osanchez consulta 290989 Nov 28 14:01 ./switch_0008281340.p00.Z
406135 296 -rw-r--r-- 1 osanchez consulta 294292 Nov 28 15:02 ./switch_0010281501.p00.Z
406136 296 -rw-r--r-- 1 osanchez consulta 292930 Nov 28 16:01 ./switch_0011281533.p00.Z
406137 296 -rw-r--r-- 1 osanchez consulta 293208 Nov 28 15:01 ./switch_0009281427.p00.Z
406138 296 -rw-r--r-- 1 osanchez consulta 292301 Nov 28 17:01 ./switch_0012281606.p00.Z
406139 296 -rw-r--r-- 1 osanchez consulta 293222 Nov 28 17:01 ./switch_0013281640.p00.Z
406140 296 -rw-r--r-- 1 osanchez consulta 292591 Nov 28 19:01 ./switch_0016281854.p00.Z
406141 296 -rw-r--r-- 1 osanchez consulta 288642 Nov 28 22:01 ./switch_0018282155.p00.Z
406142 296 -rw-r--r-- 1 osanchez consulta 293526 Nov 26 11:16 ./switch_9965261105.p00.Z
406143 296 -rw-r--r-- 1 osanchez consulta 292978 Nov 26 11:16 ./switch_9964261035.p00.Z
406144 296 -rw-r--r-- 1 osanchez consulta 294492 Nov 26 17:03 ./switch_9972261600.p00.Z
406145 288 -rw-r--r-- 1 osanchez consulta 286188 Nov 29 09:01 ./switch_0020290837.p00.Z
406146 288 -rw-r--r-- 1 osanchez consulta 283339 Nov 29 08:01 ./switch_0019290712.p00.Z
406147 296 -rw-r--r-- 1 osanchez consulta 288473 Nov 29 12:01 ./switch_0024291121.p00.Z
406148 296 -rw-r--r-- 1 osanchez consulta 290029 Nov 29 11:01 ./switch_0023291041.p00.Z
406149 288 -rw-r--r-- 1 osanchez consulta 286444 Nov 29 10:01 ./switch_0021290923.p00.Z
406150 296 -rw-r--r-- 1 osanchez consulta 286833 Nov 29 13:01 ./switch_0026291249.p00.Z
406151 288 -rw-r--r-- 1 osanchez consulta 284229 Nov 29 15:01 ./switch_0028291456.p00.Z
406153 296 -rw-r--r-- 1 osanchez consulta 287466 Nov 29 14:01 ./switch_0027291353.p00.Z
406154 288 -rw-r--r-- 1 osanchez consulta 284635 Nov 29 17:01 ./switch_0029291602.p00.Z
406155 288 -rw-r--r-- 1 osanchez consulta 283551 Nov 29 18:01 ./switch_0030291712.p00.Z
406156 288 -rw-r--r-- 1 osanchez consulta 285430 Nov 29 20:01 ./switch_0032291938.p00.Z
406157 288 -rw-r--r-- 1 osanchez consulta 285199 Nov 29 19:01 ./switch_0031291822.p00.Z
406158 288 -rw-r--r-- 1 osanchez consulta 285792 Nov 29 22:01 ./switch_0033292106.p00.Z
406159 296 -rw-r--r-- 1 osanchez consulta 289021 Nov 30 02:01 ./switch_0034300149.p00.Z
406160 296 -rw-r--r-- 1 osanchez consulta 293621 Nov 27 10:02 ./switch_9982270946.p00.Z
406161 296 -rw-r--r-- 1 osanchez consulta 294663 Nov 27 10:02 ./switch_9981270916.p00.Z
406162 288 -rw-r--r-- 1 osanchez consulta 284979 Nov 30 11:01 ./switch_0036301008.p00.Z
406163 288 -rw-r--r-- 1 osanchez consulta 285983 Nov 30 13:01 ./switch_0038301232.p00.Z
406164 288 -rw-r--r-- 1 osanchez consulta 286500 Nov 30 12:01 ./switch_0037301119.p00.Z
406165 296 -rw-r--r-- 1 osanchez consulta 288412 Nov 30 16:01 ./switch_0040301554.p00.Z
406166 288 -rw-r--r-- 1 osanchez consulta 285269 Nov 30 15:01 ./switch_0039301403.p00.Z
406167 296 -rw-r--r-- 1 osanchez consulta 287318 Nov 30 18:01 ./switch_0041301749.p00.Z
406168 288 -rw-r--r-- 1 osanchez consulta 284892 Nov 30 20:01 ./switch_0042301930.p00.Z
406169 296 -rw-r--r-- 1 osanchez consulta 292114 Nov 30 22:01 ./switch_0043302120.p00.Z
406170 296 -rw-r--r-- 1 osanchez consulta 291967 Dec 1 09:01 ./switch_0045010822.p00.Z
406171 296 -rw-r--r-- 1 osanchez consulta 294640 Dec 1 08:01 ./switch_0044010717.p00.Z
406172 296 -rw-r--r-- 1 osanchez consulta 293721 Dec 1 09:02 ./switch_0046010857.p00.Z
406173 304 -rw-r--r-- 1 osanchez consulta 295807 Nov 28 18:01 ./switch_0014281716.p00.Z
406174 296 -rw-r--r-- 1 osanchez consulta 293506 Nov 28 18:02 ./switch_0015281758.p00.Z
406175 296 -rw-r--r-- 1 osanchez consulta 288777 Nov 28 21:01 ./switch_0017282008.p00.Z
406176 296 -rw-r--r-- 1 osanchez consulta 293602 Nov 28 10:01 ./switch_0001280918.p00.Z
406177 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 10:01 ./switch_0088030919.p00
406178 296 -rw-r--r-- 1 osanchez consulta 293063 Dec 1 11:02 ./switch_0050011054.p00.Z
406179 296 -rw-r--r-- 1 osanchez consulta 294176 Dec 1 11:02 ./switch_0047010926.p00.Z
406180 296 -rw-r--r-- 1 osanchez consulta 293682 Dec 1 11:02 ./switch_0048010955.p00.Z
406214 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 10:01 ./switch_0089030948.p00
406181 296 -rw-r--r-- 1 osanchez consulta 291386 Dec 1 11:02 ./switch_0049011025.p00.Z
406182 296 -rw-r--r-- 1 osanchez consulta 294178 Dec 1 12:02 ./switch_0051011122.p00.Z
406183 296 -rw-r--r-- 1 osanchez consulta 291102 Dec 1 13:01 ./switch_0053011235.p00.Z
406184 296 -rw-r--r-- 1 osanchez consulta 291612 Dec 1 14:01 ./switch_0054011345.p00.Z
406185 304 -rw-r--r-- 1 osanchez consulta 295246 Dec 1 16:02 ./switch_0056011504.p00.Z
406186 296 -rw-r--r-- 1 osanchez consulta 293625 Dec 1 16:03 ./switch_0057011537.p00.Z
406187 296 -rw-r--r-- 1 osanchez consulta 294773 Dec 1 17:01 ./switch_0058011610.p00.Z
406188 296 -rw-r--r-- 1 osanchez consulta 294622 Dec 1 17:02 ./switch_0059011645.p00.Z
406189 304 -rw-r--r-- 1 osanchez consulta 296283 Dec 1 18:01 ./switch_0060011721.p00.Z
406190 296 -rw-r--r-- 1 osanchez consulta 291868 Dec 1 19:01 ./switch_0062011901.p00.Z
406191 296 -rw-r--r-- 1 osanchez consulta 294813 Dec 1 18:02 ./switch_0061011801.p00.Z
406192 296 -rw-r--r-- 1 osanchez consulta 293143 Dec 1 23:01 ./switch_0064012226.p00.Z
406193 296 -rw-r--r-- 1 osanchez consulta 289986 Dec 1 21:01 ./switch_0063012015.p00.Z
406194 296 -rw-r--r-- 1 osanchez consulta 294248 Dec 2 08:01 ./switch_0065020751.p00.Z
406195 296 -rw-r--r-- 1 osanchez consulta 290602 Dec 2 09:01 ./switch_0066020837.p00.Z
406196 296 -rw-r--r-- 1 osanchez consulta 288440 Nov 29 13:01 ./switch_0025291201.p00.Z
406197 296 -rw-r--r-- 1 osanchez consulta 287283 Nov 30 09:01 ./switch_0035300847.p00.Z
406198 296 -rw-r--r-- 1 osanchez consulta 293258 Dec 2 10:01 ./switch_0068020938.p00.Z
406199 296 -rw-r--r-- 1 osanchez consulta 292573 Dec 2 10:01 ./switch_0067020909.p00.Z
406200 296 -rw-r--r-- 1 osanchez consulta 291750 Dec 2 12:01 ./switch_0071021105.p00.Z
406201 296 -rw-r--r-- 1 osanchez consulta 292676 Dec 2 12:01 ./switch_0072021135.p00.Z
406202 296 -rw-r--r-- 1 osanchez consulta 292291 Dec 2 11:02 ./switch_0070021036.p00.Z
406203 296 -rw-r--r-- 1 osanchez consulta 292437 Dec 2 13:01 ./switch_0073021209.p00.Z
406204 296 -rw-r--r-- 1 osanchez consulta 289176 Dec 2 14:01 ./switch_0074021311.p00.Z
406205 296 -rw-r--r-- 1 osanchez consulta 291652 Dec 2 17:01 ./switch_0080021659.p00.Z
406206 296 -rw-r--r-- 1 osanchez consulta 290728 Dec 2 16:01 ./switch_0078021553.p00.Z
406207 296 -rw-r--r-- 1 osanchez consulta 289884 Dec 2 15:01 ./switch_0075021414.p00.Z
406208 296 -rw-r--r-- 1 osanchez consulta 291273 Dec 2 19:01 ./switch_0082021826.p00.Z
406209 296 -rw-r--r-- 1 osanchez consulta 290059 Dec 2 21:01 ./switch_0084022055.p00.Z
406210 296 -rw-r--r-- 1 osanchez consulta 287874 Dec 2 20:01 ./switch_0083021932.p00.Z
406211 304 -rw-r--r-- 1 osanchez consulta 295963 Dec 3 09:01 ./switch_0086030812.p00.Z
406212 296 -rw-r--r-- 1 osanchez consulta 293625 Dec 3 09:02 ./switch_0087030849.p00.Z
406213 304 -rw-r--r-- 1 osanchez consulta 296618 Dec 3 07:01 ./switch_0085030632.p00.Z
406215 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 11:02 ./switch_0090031016.p00
406216 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 12:01 ./switch_0093031144.p00
406217 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 12:01 ./switch_0092031113.p00
406218 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 11:02 ./switch_0091031045.p00
406219 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 13:01 ./switch_0094031223.p00
406220 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 14:01 ./switch_0095031329.p00
406221 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 15:01 ./switch_0096031423.p00
406222 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 15:02 ./switch_0097031457.p00
406223 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 16:01 ./switch_0098031530.p00
406224 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 17:01 ./switch_0099031602.p00
406225 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 18:01 ./switch_0101031711.p00
406226 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 18:02 ./switch_0102031750.p00
406227 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 17:01 ./switch_0100031636.p00
406228 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 19:01 ./switch_0103031844.p00
406229 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 21:01 ./switch_0105032101.p00
406230 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 3 20:01 ./switch_0104031956.p00
406231 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 09:01 ./switch_0108040849.p00
406232 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 09:01 ./switch_0107040810.p00
406233 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 07:03 ./switch_0106040614.p00
406234 296 -rw-r--r-- 1 osanchez consulta 294420 Dec 1 15:02 ./switch_0055011430.p00.Z
406235 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 10:02 ./switch_0110040952.p00
406236 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 10:02 ./switch_0109040921.p00
406237 296 -rw-r--r-- 1 osanchez consulta 293770 Dec 1 12:02 ./switch_0052011152.p00.Z
406238 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 13:01 ./switch_0115041223.p00
406239 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 12:02 ./switch_0113041117.p00
406240 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 12:03 ./switch_0114041146.p00
406241 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 11:01 ./switch_0111041020.p00
406242 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 11:01 ./switch_0112041049.p00
406243 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 15:01 ./switch_0118041451.p00
406245 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 15:01 ./switch_0117041418.p00
406246 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 14:01 ./switch_0116041324.p00
406247 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 16:01 ./switch_0119041522.p00
406248 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 17:01 ./switch_0121041630.p00
406249 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 16:01 ./switch_0120041555.p00
406250 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 18:01 ./switch_0123041748.p00
406251 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 19:01 ./switch_0124041841.p00
406252 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 18:01 ./switch_0122041707.p00
406253 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 22:01 ./switch_0126042120.p00
406254 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 4 20:01 ./switch_0125041949.p00
406255 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 09:01 ./switch_0128050822.p00
406256 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 09:01 ./switch_0129050859.p00
406257 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 07:01 ./switch_0127050701.p00
406258 296 -rw-r--r-- 1 osanchez consulta 291799 Dec 2 11:02 ./switch_0069021007.p00.Z
406259 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 10:02 ./switch_0131050959.p00
768992 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 10:02 ./switch_0130050930.p00
406261 296 -rw-r--r-- 1 osanchez consulta 291456 Dec 2 17:01 ./switch_0079021626.p00.Z
406262 296 -rw-r--r-- 1 osanchez consulta 292010 Dec 2 16:01 ./switch_0077021521.p00.Z
406263 296 -rw-r--r-- 1 osanchez consulta 291895 Dec 2 15:02 ./switch_0076021449.p00.Z
406264 296 -rw-r--r-- 1 osanchez consulta 293038 Dec 2 18:02 ./switch_0081021738.p00.Z
406265 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 12:02 ./switch_0135051159.p00
406266 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 12:01 ./switch_0134051127.p00
406267 2200 -rw-r--r-- 1 osanchez consulta 2240000 Dec 5 11:01 ./switch_0132051028.p00


#!/usr/bin/bash

#control_archivos.txt
#NB_CENTRAL;Prefijo;Tamaño Prefijo;Pos. Inicial Consecutivo;Tamaño Consecutivo;MTE;segmentacion;tope
#switch;switch_;7;8;4;0;0
#switch1;switch1_;8;9;4;0;0

declare -a array
#cont=1

for i in `cat control_archivos.txt`
do
array=(`echo $i |awk ' {split($0,a,";"); for (j=0;j<=6;j++ ) printf a[j]" " } '`)

if [[ ${array[5]} -eq 0 && ${array[6]} -eq 0 ]]; then

find . ! -name . -prune -type f -name "${array[1]}*" -mtime -15 -ls > ${array[0]}".txt1"
sort -k8M -k9 ${array[0]}".txt1" > ${array[0]}".txt"
rm ${array[0]}".txt1"
awk -v central=${array[0]} ' BEGIN{FS=";"
while ( (getline < "control_archivos.txt" ) > 0 ){
if ( $1 ~ central ) {
central=$1
prefijo=$2
tama_prefijo=$3
pos=$4
tama=$5
mte=$6
segmentacion=$7
}
}
close("control_archivos.txt")
FS=" "
h=1
banda=0
}
{
if (NR==1) { mayor = substr($11,pos+2,tama)+0; menor = substr($11,pos+2,tama)+0;anterior=substr($11,pos+2,tama)+0;}
if ( substr($11,pos+2,tama)+0 > mayor ) mayor = substr($11,pos+2,tama)+0
if ( substr($11,pos+2,tama)+0 < menor ) menor = substr($11,pos+2,tama)+0
f=substr($11,pos+2,tama)+0
Gile[h]=f";"$8";"$9
if ( f == "0" ) {
band=1
cero=h
medio=Gile[h]
}
inicio=Gile[1]
ultimo=h++
}
}
END{
print menor "," mayor
print "1 " Gile[1] " " ultimo " " Gile[ultimo]
w=tama
unomenos=0
archivo=inicio
ultimo_archivo=Gile[ultimo]
if ( band ==1){
split(inicio,f1,";")
f1[1]+=0
for ( y=1;y<cero;y++){
split(Gile[y],track,";")
track[1]+=0
if ( track[1] > f1[1] ) menor1=f1[1]
else menor1=track[1]
}
print menor1"-"
print "reinicio"
split(medio,f0,";")
print medio"-medio"
print f0[1]
for ( d=cero;d<=ultimo;d++){
split(Gile[d],track,";")
track[1]+=0
if ( track[1] > f0[1] ) mayor1=track[1]
# print mayor1 "-mayor1 "track[1]
}
print mayor1
print "con cruce por cero "menor1" "mayor1
}
else{
print "sin cruce por cero " menor" "mayor
}
} ' ${array[0]}".txt"

fi

done
exit

output

---------------------------------------
switch
first file :0, last file :9999 ###wrong
switch
first file 9866;Nov;20 last file 268 135;Dec;5

fisrt file :9866:9866;Nov;20
reinicio
middle file :0;Nov;28
last file :135 : 135;Dec;5

I want to know what files don't appear, in this case:

FILE 9874
FILE 0133

But my program have problems for example if the file 0000 dont appeared what happened.??

I want to improved this programmm??

I want to know the first file , the last file and what files don´t appear, if I take a list of files between two dates.

It's possible that someone send a file four days later.


Thanks malpa
 
Please take a look at this and see if I am understanding you. Am I on the right track?

ls -l /your/dir | awk '{print substr($NF, index($NF,"_")+1, 4)}' | sort +0n | awk 'BEGIN {getline TMP1; while(getline TMP2 > 0) if(TMP2 > TMP1 + 1) for(i=TMP1+1; i < TMP2; i++) print i; TMP1 = TMP2}}'
 
Hi booke

I was working on it, but your code only function until sort +0n command.
After this, I have to do a kill -9.


first I made a configuration file

file control_archivos.txt
switch1;S[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9];1;2;4;0;0;S;1

My files on the directory

-rw-r--r-- 1 pimentel iguaran 179846 Nov 25 08:30 S6507081122_rngmi.Z
-rw-r--r-- 1 pimentel iguaran 179846 Nov 25 08:49 S6507081122.Z
-rw-r--r-- 1 pimentel iguaran 498013 Nov 25 09:20 S6513081124.Z
-rw-r--r-- 1 pimentel iguaran 490605 Nov 25 09:50 S6514081124.Z
-rw-r--r-- 1 pimentel iguaran 501569 Nov 25 10:00 S6515081125.Z
-rw-r--r-- 1 pimentel iguaran 491043 Nov 25 11:30 S6516081125.Z
-rw-r--r-- 1 pimentel iguaran 495877 Nov 25 14:20 S6517081125.Z
-rw-r--r-- 1 pimentel iguaran 496625 Nov 25 17:20 S6518081125.Z
-rw-r--r-- 1 pimentel iguaran 499319 Nov 25 23:20 S6519081125.Z
-rw-r--r-- 1 pimentel iguaran 497355 Nov 26 11:20 S6520081126.Z
-rw-r--r-- 1 pimentel iguaran 494305 Nov 26 16:21 S6521081126.Z
-rw-r--r-- 1 pimentel iguaran 494741 Nov 26 17:21 S6522081126.Z
-rw-r--r-- 1 pimentel iguaran 498191 Dec 1 11:21 S6523081127.Z
-rw-r--r-- 1 pimentel iguaran 498687 Dec 1 11:31 S6524081127.Z
-rw-r--r-- 1 pimentel iguaran 495043 Dec 1 11:41 S6525081128.Z
-rw-r--r-- 1 pimentel iguaran 495421 Dec 1 11:51 S6526081128.Z
-rw-r--r-- 1 pimentel iguaran 496821 Dec 1 12:01 S6527081128.Z
-rw-r--r-- 1 pimentel iguaran 496641 Dec 1 12:11 S6528081128.Z
-rw-r--r-- 1 pimentel iguaran 493195 Dec 1 12:21 S6529081128.Z
-rw-r--r-- 1 pimentel iguaran 494733 Dec 1 12:31 S6530081128.Z
-rw-r--r-- 1 pimentel iguaran 495877 Dec 1 12:41 S6531081128.Z
-rw-r--r-- 1 pimentel iguaran 499757 Dec 1 12:51 S6532081129.Z
-rw-r--r-- 1 pimentel iguaran 495713 Dec 1 13:01 S6533081129.Z
-rw-r--r-- 1 pimentel iguaran 496061 Dec 1 13:11 S6534081129.Z
-rw-r--r-- 1 pimentel iguaran 498063 Dec 1 13:21 S6535081129.Z
-rw-r--r-- 1 pimentel iguaran 497885 Dec 1 13:31 S6536081130.Z
-rw-r--r-- 1 pimentel iguaran 497487 Dec 1 13:41 S6537081130.Z
-rw-r--r-- 1 pimentel iguaran 500439 Dec 1 13:51 S6538081201.Z
-rw-r--r-- 1 pimentel iguaran 493829 Dec 1 14:41 S6539081201.Z
-rw-r--r-- 1 pimentel iguaran 495381 Dec 1 17:21 S6540081201.Z
-rw-r--r-- 1 pimentel iguaran 495385 Dec 1 20:21 S6541081201.Z
-rw-r--r-- 1 pimentel iguaran 502995 Dec 2 08:21 S6542081202.Z
-rw-r--r-- 1 pimentel iguaran 492271 Dec 3 17:01 S6544081202.Z
-rw-r--r-- 1 pimentel iguaran 498691 Dec 3 17:11 S6546081203.Z
-rw-r--r-- 1 pimentel iguaran 490921 Dec 3 17:21 S6545081202.Z
-rw-r--r-- 1 pimentel iguaran 492803 Dec 3 17:31 S6547081203.Z
-rw-r--r-- 1 pimentel iguaran 493305 Dec 3 17:41 S6548081203.Z
-rw-r--r-- 1 pimentel iguaran 495617 Dec 3 17:51 S6549081203.Z
-rw-r--r-- 1 pimentel iguaran 499361 Dec 3 23:21 S6550081203.Z
-rw-r--r-- 1 pimentel iguaran 497397 Dec 4 11:21 S6551081204.Z
-rw-r--r-- 1 pimentel iguaran 495261 Dec 4 14:21 S6552081204.Z
-rw-r--r-- 1 pimentel iguaran 491591 Dec 5 10:21 S6543081204.Z
-rw-r--r-- 1 pimentel iguaran 4096000 Dec 9 11:06 S6553081204
-rw-r--r-- 1 pimentel iguaran 4096000 Dec 9 11:16 S6554081204
-rw-r--r-- 1 pimentel iguaran 4096000 Dec 9 11:26 S6555081205

Booke ,firts you must to order files by date, after this find out the first and last file. You must to order again by the values, in this case S[1][2][3][4]*.
With this values you must to find the files that doesn´t exits.

for ( i=first_file to i=last_file )
if !( i in array ) { the file doen´t exist }

What is the problem? When the next file is S0000* always the first file is S0000* and the last file S9999. It is an error.

Example

S9998* Dec 1
S0000* Dec 2
s0001* Dec 2
S0002* Dec 2
S9999* Dec 3


The first file must be S9998* and the last file S0002*

w=5
for ( i=9998 to i=10002 )
i = sprintf("%0+*%s", w,i)
if !( substr(i,2,4) in array ) { file doesn´t exist }

but when I order the files my first file always is S0000* and last file S9999*. it is an error.

OUTPUT

FILE S6508 DOESN´T EXIST
FILE S6509 DOESN´T EXIST
FILE S6510 DOESN´T EXIST
FILE S6511 DOESN´T EXIST
FILE S6512 DOESN´T EXIST

Thanks for your replay booke!!
 

Try this:
Code:
$ ls -l /your/dir|awk '{print substr($9,2,4)":"$0}' |sort |\
> awk -F: 'BEGIN{lst=-1}{gap=(int($1)-lst); if (lst>0&&gap>1) print lst+1" - "$1-1" gap="gap-1; lst=$1;}'
6508 - 6512 gap=5
$
[3eyes]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Would this be correct ...

ls -ltr /your/dir # This puts the files in the correct sort order.

The starting file number would be the first substr of $NF and the ending file number would be the last file shown in the listing - Correct ??
 
Hi

Thanks for your opportune collaboration gentlemen.

Booke, when I run your programm, I have to kill it, I Think I made a mistake

ls -l /your/dir |
awk '{
print substr($NF, index($NF,"_")+1, 4)}' |
sort +0n |
awk 'BEGIN {getline TMP1
while(getline TMP2 > 0)
if(TMP2 > TMP1 + 1)
for(i=TMP1+1; i < TMP2; i++)
print i
TMP1 = TMP2
} ??
}'


LKBrwnDBA
Your programma works, but when I make a files

touch -t 200812101010.10 S7000081205
touch -t 200812101010.10 S0000081205

output

6508 - 6512 gap=5
6556 - 6999 gap=444

it must be

6508 - 6512 gap=5
6556 - 6999 gap=444
7001 - 9999 gap=3008

and if I make a new file for example

touch -t 200812111010.10 S0003081205

Which would be the output??


Thanks again for your assistance


malpa

 
Your requirement did not state that lower boundary was 0000 and upper boundary was 9999.

Ok, if you added these files:

touch -t 200812101010.10 S7000081205
touch -t 200812101010.10 S0000081205
touch -t 200812111010.10 S0003081205

Then the result is:
Code:
#!/bin/ksh
ls -l|awk '{print substr($9,2,4)":"$0}' |sort |\
awk -F: 'BEGIN{lst=-1}{gap=(int($1)-lst); if (gap>1) print lst+1" - "$1-1" gap="gap-1; lst=$1;}
END {gap=9999-lst;print lst+1" - 9999 gap="gap;}'
$ MyScript
1 - 2 gap=2
4 - 6506 gap=6503
6508 - 6512 gap=5
6556 - 6999 gap=444
7001 - 9999 gap=2999
[pipe]




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 

Actually the script should be corrected to this:
Code:
#!/bin/ksh
ls -l|awk '{print substr($9,2,4)":"$0}' |sort |\
awk -F: 'BEGIN{lst=9999}{gap=(int($1)-lst); if (gap>1) print lst+1" - "$1-1" gap="gap-1; lst=$1;}
END {gap=9999-lst;print lst+1" - 9999 gap="gap;}'


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Sorry Malpa, there should have been an opening curly brace after -> while(getline TMP2 > 0) {
 
Hi

Thanks a lot Booke and LKBrwnDBA.


I develop to my tasks with UNIX and awk for at least 3 years. Every time fascinating encounter awk. I love UNIX and awk.

I did the same but with 30 lines more of program.??
Last night I finish my programm, but compared with the programs of you, my program is a little big. ? Thanks I will reduce my program with the programs sent by you, thank you very much.


malpa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top