fork download
  1. #!/bin/bash
  2. NR_OF_ARGS=$#
  3. OUTPUT_FILE_NAME="sorted.out"
  4.  
  5. if [ $NR_OF_ARGS -eq 1 ]; then
  6. if [ -f $1 ]; then
  7. INPUT_FILE=$1
  8. file_content=$(<$INPUT_FILE)
  9.  
  10. echo -e $file_content
  11. echo -e $file_content | sort -k5,5 -k4,4 -k3,3 > $OUTPUT_FILE_NAME
  12. echo "-------------------------------------------------"
  13. cat $OUTPUT_FILE_NAME
  14. else
  15. echo "No valid input file provided"
  16. fi
  17. else
  18. echo "USAGE $0 inputfile"
  19. fi
Success #stdin #stdout 0.03s 5268KB
stdin
Standard input is empty
stdout
USAGE prog.sh inputfile