Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/awk -f
- BEGIN {
- FS = "";
- }
- value ~ "MYVALUE" # silly test
- {
- print "1 - " substr($0, 235, 12);
- }
- $235 ~ "M" {
- print "2 - " substr($0, 235, 12);
- }
- {
- if(value == substr($0, 235, 12))
- {
- print "3 - " substr($0, 235, 12);
- }
- if(match(value,substr($0, 235, 12)))
- {
- print "4 - " substr($0, 235, 12);
- }
- }
- END {
- print "exit"
- }
- $ ls -l $(which awk)
- lrwxrwxrwx 1 root root 4 Jul 10 2015 /bin/awk -> gawk
- $ gawk --version
- GNU Awk 3.1.5
- $235 ~ "M"
- {
- print "2 - " substr($0, 235, 12);
- }
- $235...$247 ~ value
- #!/usr/bin/python
- import re
- t = 'ABC'
- rg = '^.{235,235}' + t
- rgx = re.compile(rg)
- tt = '00000ABC00'
- if(rgx.match(tt)):
- print "OK"
- else:
- print "KO"
- {
- if(substr($0, 235, 12) ~ value)
- {
- print "4 - " substr($0, 235, 12)
- next
- }
- else
- {
- print "4 - NOK"
- next
- }
- }
- $235, $247 ~ value { ... action here ... }
- substr($0, 235, 12) ~ value { ... action here ... }
- $235 ~ "M" { print "2 - " substr($0, 235, 12); }
- $235 ~ "M"
- { print "2 - " substr($0, 235, 12); }
- BEGIN { FS="" }
- # oursubstr will be updated first for each record.
- { oursubstr = substr($0, 235, 12) }
- oursubstr ~ value { ... action ... }
- ...
Add Comment
Please, Sign In to add comment