Skip to content
Advertisement

compare the length of multiple files using awk or sed

I want to compare the number of lines of each file and choose the one that contains the maximum number of lines for example

JavaScript

I will get as result

JavaScript

Advertisement

Answer

Alternative with lot’s of piping

JavaScript

this script assumes the file names are under your control and space or _V won’t appear in the base names. Otherwise check out @Qualia’s version.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement