Fascination with AWK
maximullaris.com
maximullaris.com
The awk program translates to
#!/usr/bin/perl
while (<>) {
push @freq, (split)[2..-1] if /Frequencies/;
push @fc, (reverse(split))[3..-1] if /Frc consts/;
push @ir, (reverse(split))[3..-1] if /IR Inten/;
}print "@freq[$_ - 1] $fc[$_] $ir[$_]\n" for 1..@freq;
and in python
#!/usr/bin/env python3
import sys
freq = []
fc = []
ir = []
for line in sys.stdin:
fields = line.split()
if "Frequencies" in line:
freq.extend(fields[2:])
elif "Frc consts" in line:
fc.extend(reversed(fields[3:]))
elif "IR Inten" in line:
ir.extend(reversed(fields[3:]))
for i in range(len(freq)): print(freq[i], fc[i], ir[i])