Skip to content
Discussion options

You must be logged in to vote

Hi @eugeniadamato,

A few things to look into:

  1. Take a closer look at your awk statement if($3 = "Bottled Water"). It's supposed to only keep rows where the 3rd column is Bottled Water. BUT if you calculate the number of lines after filtering, you'll see it's exactly the same as without filtering, so something is off:
guest@sandbox$ wc -l orders.tsv 
4623 orders.tsv

guest@sandbox$ awk -F "\t" ' { if($3 = "Bottled Water") print $2}' orders.tsv | wc -l
4623
  1. When doing orders.tsv > temp1 | sort, the issue is you shouldn't mix both patterns of command > file and command | command. You can either rewrite this so there's no > temp1 and you keep piping the output of awk to sort directly withou…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@eugeniadamato
Comment options

@robertaboukhalil
Comment options

Answer selected by robertaboukhalil
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants