Skip to content

Instantly share code, notes, and snippets.

@fouad-j
Created October 27, 2016 23:07
Show Gist options
  • Save fouad-j/08bddfb2c098c01cb5f66a854e32827b to your computer and use it in GitHub Desktop.
Save fouad-j/08bddfb2c098c01cb5f66a854e32827b to your computer and use it in GitHub Desktop.
Allow to filter data with awk
awk 'BEGIN {FS=";"}
((length($2)>5 || length($3)==7) && length($4)==0) {print "OK " $0; next}
{print "KO " $0}
' file
# input data
# col11OK;col12;col13
# col21;col22OK;col23
# col31;col32;col33OK
# col41;col42;col43KO;col44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment