0

I am trying to sort the output of an awk script which contains 2 lines of header information (which should not be sorted). For that I am using tee command in tcsh shell as shown below

 awk -f scr.awk tmp.txt | tee >(head -n 2 > tm) >(tail -n +3 | sort -k1,1 >> tm)

The above code is not working; it is giving the error Missing name for redirect. How can I fix this?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
yow
  • 13
  • 1
  • 4
  • Welcome on Stackoverflow. Apparently your problem is a shell problem, not (yet) a make problem. The first thing to do is to solve this shell problem. You could maybe edit your question, including the tags, explain what shell you are using, what is your goal, keep showing what you tried and the results, and ask for help for writing your shell script. – Renaud Pacalet Sep 21 '18 at 07:15
  • Possible duplicate of ["How can I use Bash syntax in Makefile targets? "](https://stackoverflow.com/questions/589276/how-can-i-use-bash-syntax-in-makefile-targets). – G.M. Sep 21 '18 at 08:25
  • The `>(…)` notation is a Bash extension to POSIX shell called [process substitution](https://www.gnu.org/software/bash/manual/bash.html#Process-Substitution). It is not available in tcsh AFAIK. You might do better with a [tag:tcsh] or [tag:csh] tag (or both) on the question. If I understand your question, you're seeking to leave the first two lines of the output from the Awk script unchanged and then sort the remainder on the first field — is that right? – Jonathan Leffler Mar 08 '19 at 17:43
  • Tangentially, the sites https://www.tcsh.org/ and http://www.tcsh.org/ both appear to be non-responsive as of 2019-04-08 09:45 UTC-08. – Jonathan Leffler Mar 08 '19 at 17:46

0 Answers0