Sorting positive and negative values

Hello,
I have a list like this :

1
2
-4
0
-3
-7
5
6 etc.

Is there a way to remove all the positive values and print only the negative values, without using grep, sed or awk?

Thanks,
Prasanna

perl -ne 'print if $_<0;' file
strings -n2 file
while read n
do 
  if [ $n -lt 0 ]; then 
    echo $n
  fi
done < infile

---------- Post updated at 02:00 ---------- Previous update was at 00:28 ----------

cut -sd- -f1- infile
1 Like

Thanks a lot.