0

I have this line of code where i go to the 4th column , get the maximum number and print it out

maximum=$(sort -u -k4 -nr Logname.csv | tail-2)

but its showing me this error

sort: fflush failed: standard output: Broken pipe sort: write error

Anyone can help me fix this?

tash517
  • 171
  • 1
  • 4
  • 12

1 Answers1

0

tail-2 is not a command, so there is no process running for sort to write its output to, hence the "broken pipe" error. You forgot the space:

maximum=$(sort -u -k4 -nr Logname.csv | tail -2)
                                           ^^^
chepner
  • 497,756
  • 71
  • 530
  • 681