Ask Your Question

How can I only get the Column with the Filename from a ls -all output with Awk?

asked 2023-04-07 12:04:10 +0000

qstack gravatar image

updated 2023-04-07 18:35:57 +0000

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-04-07 12:13:39 +0000

qstack gravatar image

You can use awk the following way:

ls -all my_directory/* | awk '{print $9}'

This will only print the filename.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools

1 follower


Asked: 2023-04-07 12:04:10 +0000

Seen: 24 times

Last updated: Apr 07 '23