Back to problems

Bash Largest File from Listing Output

Algorithm · Intuit · Medium

Requirements Write a Bash or shell-oriented text-processing solution that identifies the file name associated with the greatest size in listing-style input. One version supplies a multiline string representing ls -l output and asks for the largest file name. Your solution must: Parse the columns used by ls -l correctly. Compare entries using the file-size column. Keep names containing spaces intact. Produce the file name rather than only its size. A second version asks for…

Checking your access…