Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to sort a result of Ls -l command based on columns. Ex.
i want to sort 5th column from output of ls -l command.

Answers were Sorted based on User's Feedback



How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output ..

Answer / xxx

ls -l|sort -nk5

Is This Answer Correct ?    21 Yes 2 No

How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output ..

Answer / kiran

$ ls -al | sort -n -k5

The -n in my example means "sort numerically", and the -k5
option means to key off of column five. Like other Unix
commands, these options can be combined and shortened, like
this:

$ ls -al | sort -nk5

Is This Answer Correct ?    13 Yes 1 No

How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output ..

Answer / amrapalee jawalikar

ls -l | sort +4 -5

Is This Answer Correct ?    2 Yes 1 No

How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output ..

Answer / karunaprakash

Place the selected 5th coloumn in the file file1 and sort
the file1.


$ ls -l | cut -f 5 > file1
$sort file1

Is This Answer Correct ?    1 Yes 1 No

How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output ..

Answer / vikas

ls -al | sort | cut -d ' ' -f 5

Is This Answer Correct ?    2 Yes 9 No

How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output ..

Answer / rajesh

ls -l | awk '{print $5}'

Is This Answer Correct ?    7 Yes 16 No

Post New Answer

More Shell Script Interview Questions

How to enable the shell to know what program should be run to interpret the script?

3 Answers  


How can the contents of a file inside jar be read without extracting in a shell script?

0 Answers  


How do I open a jshell in cmd?

0 Answers  


How do you read arguments in a shell program - $1, $2 ..?

4 Answers  


What is bash eval?

0 Answers  


What is bourne shell scripting?

0 Answers  


HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL SHELL SCRIPT?

3 Answers   Patni,


What are the different methods available to run a shell script?

2 Answers  


Write a command sequence to find the count of each word?

0 Answers  


What is Path variable?What is its use?

1 Answers  


What command needs to be used to take the backup?

0 Answers  


What is meant by $1 in shell script?

0 Answers  


Categories