Skip to content

Instantly share code, notes, and snippets.

@flatcap
Last active August 29, 2015 14:19
Show Gist options
  • Save flatcap/5e8ee30e8d717ebcd9f1 to your computer and use it in GitHub Desktop.
Save flatcap/5e8ee30e8d717ebcd9f1 to your computer and use it in GitHub Desktop.
galaxywatcher's max field length: http://www.commandlinefu.com/commands/view/14164
#!/usr/bin/awk -f
BEGIN {
FS = "|";
OFS = "|";
}
(NR == 1) {
for (b = 1; b <= NF; b++) {
hdr[b] = $b;
}
}
(NR > 1) {
for (i = 1; i <= NF; i++) {
if (length($i) > max[i]) {
max[i] = length($i);
}
}
}
END {
for (i = 1; i <= NF; i++) {
print hdr[i], max[i] + 0;
}
}
#!/bin/bash
awk -f max.awk names.psv
A-name|B-name|C-name|D-name|E-name
Aaron|Babara|Caitlin|Dacia|Earlean
Abbey|Babette|Caitlyn|Dagmar|Earleen
Abbie|Bailey|Calandra|Dagny|Earlene
Abby|Bambi|Calista|Dahlia|Earlie
Abigail|Bao|Callie|Daina|Earline
Ada|Barabara|Camelia|Daine|Earnestine
Adah|Barb|Camellia|Daisey|Eartha
Adaline|Barbar|Cameron|Daisy|Easter
Adam|Barbara|Cami|Dakota|Eboni
Addie|Barbera|Camie|Dale|Ebonie
Adela|Barbie|Camila|Dalene|Ebony
Adelaida|Barbra|Camilla|Dalia|Echo
Adelaide|Bari|Camille|Dalila|Eda
Adele|Barrie|Cammie|Dallas|Edda
Adelia|Basilia|Cammy|Damaris|Eddie
Adelina|Bea|Candace|Dan|Edelmira
Adeline|Beata|Candance|Dana|Eden
Adell|Beatrice|Candelaria|Danae|Edie
Adella|Beatris|Candi|Danelle|Edith
Adelle|Beatriz|Candice|Danette|Edna
Adena|Beaulah|Candida|Dani|Edra
Adina|Bebe|Candie|Dania|Edris
Adria|Becki|Candis|Danica|Edward
Adrian|Beckie|Candra|Daniel|Edwina
Adriana|Becky|Candy|Daniela|Edyth
Adriane|Bee|Candyce|Daniele|Edythe
Adrianna|Belen|Caprice|Daniell|Effie
Adrianne|Belia|Cara|Daniella|Ehtel
Adrien|Belinda|Caren|Danielle|Eileen
Adriene|Belkis|Carey|Danika|Eilene
Adrienne|Bell|Cari|Danille|Ela
Afton|Bella|Caridad|Danita|Eladia
Agatha|Belle|Carie|Dann|Elaina
Agnes|Belva|Carin|Danna|Elaine
Agnus|Benita|Carina|Dannette|Elana
Agripina|Bennie|Carisa|Dannie|Elane
Agueda|Berenice|Carissa|Dannielle|Elanor
Agustina|Berna|Carita|Danuta|Elayne
Ai|Bernadette|Carl|Danyel|Elba
Aida|Bernadine|Carla|Danyell|Elda
Aide|Bernarda|Carlee|Danyelle|Eldora
Aiko|Bernardina|Carleen|Daphine|Eleanor
Aileen|Bernardine|Carlena|Daphne|Eleanora
Ailene|Berneice|Carlene|Dara|Eleanore
Aimee|Bernetta|Carletta|Darby|Elease
Aisha|Bernice|Carley|Darcel|Elena
Aja|Bernie|Carli|Darcey|Elene
Akiko|Berniece|Carlie|Darci|Eleni
Akilah|Bernita|Carline|Darcie|Elenor
Alaina|Berry|Carlita|Darcy|Elenora
Alaine|Berta|Carlos|Daria|Elenore
Alana|Bertha|Carlota|Darla|Eleonor
Alane|Bertie|Carlotta|Darleen|Eleonora
Alanna|Beryl|Carly|Darlena|Eleonore
Alayna|Bess|Carlyn|Darlene|Elfreda
Alba|Bessie|Carma|Darline|Elfrieda
Albert|Beth|Carman|Darnell|Elfriede
Alberta|Bethanie|Carmel|Daryl|Elia
Albertha|Bethann|Carmela|David|Eliana
Albertina|Bethany|Carmelia|Davida|Elicia
Albertine|Bethel|Carmelina|Davina|Elida
Albina|Betsey|Carmelita|Dawn|Elidia
Alda|Betsy|Carmella|Dawna|Elin
Alease|Bette|Carmen|Dawne|Elina
Alecia|Bettie|Carmina|Dayle|Elinor
Aleen|Bettina|Carmon|Dayna|Elinore
Aleida|Betty|Carol|Daysi|Elisa
Aleisha|Bettyann|Carola|Deadra|Elisabeth
Alejandra|Bettye|Carolann|Dean|Elise
Alejandrina|Beula|Carole|Deana|Elisha
Alena|Beulah|Carolee|Deandra|Elissa
Alene|Bev|Carolin|Deandrea|Eliz
Alesha|Beverlee|Carolina|Deane|Eliza
Aleshia|Beverley|Caroline|Deann|Elizabet
Alesia|Beverly|Caroll|Deanna|Elizabeth
Alessandra|Bianca|Carolyn|Deanne|Elizbeth
Aleta|Bibi|Carolyne|Deb|Elizebeth
Aletha|Billi|Carolynn|Debbi|Elke
Alethea|Billie|Caron|Debbie|Ella
Alethia|Billy|Caroyln|Debbra|Ellamae
Alex|Billye|Carri|Debby|Ellan
Alexa|Birdie|Carrie|Debera|Ellen
Alexander|Birgit|Carrol|Debi|Ellena
Alexandra|Blair|Carroll|Debora|Elli
Alexandria|Blake|Carry|Deborah|Ellie
Alexia|Blanca|Cary|Debra|Ellis
Alexis|Blanch|Caryl|Debrah|Elly
Alfreda|Blanche|Carylon|Debroah|Ellyn
Alfredia|Blondell|Caryn|Dede|Elma
Ali|Blossom|Casandra|Dedra|Elmer
Alia|Blythe|Casey|Dee|Elmira
Alica|Bobbi|Casie|Deeann|Elna
Alice|Bobbie|Casimira|Deeanna|Elnora
Alicia|Bobby|Cassandra|Deedee|Elodia
Alida|Bobbye|Cassaundra|Deedra|Elois
Alina|Bobette|Cassey|Deena|Eloisa
Aline|Bok|Cassi|Deetta|Eloise
Alisa|Bong|Cassidy|Deidra|Elouise
Alise|Bonita|Cassie|Deidre|Elsa
Alisha|Bonnie|Cassondra|Deirdre|Else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment