... and to negate the conditional use an exclamation point (!) : $ echo -e "a\tb\tc\td\na\tb\t\td" | awk -F'\t' '$3 != "" {print}' a b c d
Regards, - Robert On Sat, Oct 30, 2021 at 9:46 AM Robert Citek <robert.ci...@gmail.com> wrote: > Sorry, this item didn't get pasted in my last post: > > $ echo -e "a\tb\tc\td\na\tb\t\td" | awk '{print $1" = "$2" = "$3" = "$4}' > a = b = c = d > a = b = d = > > Notice that you have to specify the field separator with the -F option, > otherwise awk compresses consecutive whitespace characters by default. > > Regards, > - Robert > > On Sat, Oct 30, 2021 at 9:41 AM Robert Citek <robert.ci...@gmail.com> > wrote: > >> Hello Rich, >> >> Here's a sample: >> >> $ echo -e "a\tb\tc\td\na\tb\t\td" | awk -F'\t' '{print}' >> a b c d >> a b d >> >> $ echo -e "a\tb\tc\td\na\tb\t\td" | awk -F'\t' '$3=="" {print}' >> a b d >> >> Good luck and let us know how it goes. >> >> Regards, >> - Robert >> >> On Sat, Oct 30, 2021 at 9:31 AM Rich Shepard <rshep...@appl-ecosys.com> >> wrote: >> >>> I've a 351K line file with 8 fields. About 50K of those lines has $8 >>> blank. >>> I want awk to print only rows with values in all 8 fields. I'm not >>> finding >>> how to tell awk to print $0 if $8 is not blank. >>> >>> My awk/sed book doesn't seem to have this information and my web searches >>> aren't finding the answer, either. >>> >>> Clue needed. >>> >>> Rich >>> >>