M
M
MaxLoL03772020-02-19 19:11:51
bash
MaxLoL0377, 2020-02-19 19:11:51

Sorting bash output?

Hello! I have bash output in the format:
line1 22
line2 32
line3 444
Please help me. You need to assign the maximum value to the variable, and delete all the rest.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Priluzkiy, 2020-02-19
@Oxyd

max=$(cut -d" " -f2 dat.txt|sort|xargs|rev|cut -d" " -f1)

This is if the data is in the dat.txt file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question