Unix Shell - Find columns 50 at 52

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > January 2006 > Find columns 50 at 52





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Find columns 50 at 52
contracer11@gmail.com

2006-01-29, 9:31 pm

Please, could you tell me how searching for in a file columns 50 at 52
and see if a number is greather than zero ?

> cat file


79589 WIN_DIARY_18 Backup Done 1 01/27/06 23:03
01/28/06 00:18 001:15:14 BDFSMURL_005
79595 ORA_SYNC Backup Active 01/28/06 00:03
007:05:41 BDFSMURL_001
79606 Duplic Done 0 01/28/06 03:03
01/28/06 03:36 000:32:41 BDFSMURL_003
79626 EXCHANGE Backup Re-Queued 134 01/28/06 06:23
000:45:43 BOLSMURG_005

Any command like this :

find columns(50at52); if (50at52 >0) then echo $line

Thanks !

Stephane CHAZELAS

2006-01-29, 9:31 pm

2006-01-28, 01:29(-08), contracer11@gmail.com:
> Please, could you tell me how searching for in a file columns 50 at 52
> and see if a number is greather than zero ?

[...]

awk 'substr($0, 50, 3) > 0'

--
Stéphane
Stephane CHAZELAS

2006-01-29, 9:31 pm

2006-01-28, 12:13(+00), Stephane CHAZELAS:
> 2006-01-28, 01:29(-08), contracer11@gmail.com:
> [...]
>
> awk 'substr($0, 50, 3) > 0'


Though:

awk 'substr($0, 50, 3) + 0 > 0'

may work better (forcing numerical comparison)

--
Stéphane
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com