ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need help, I am only new to shell but an advanced programmer in other languages, I have to write this all in script though.
Problem 1. I need to modify the output from ls -l to be more "user friendly", I would like to replace the r,w,x with read,write,exe. Was thinking I could write it to a temporary file, go through that and replace the approaite ones, then output them back to the screen.
Is there a way of using sed to catch a string?
Problem 2. I need to control the output from dmesg to only output the first ten lines.
Any help with these problems would be really great.
For the 1. I am not sure if your output will be more user friendly as the ls lines will be very long like :
ls -l ~
read write execute|read- execute|read - execute Desktop/
read-write-execute|read- -|read- - file
...
On a 80 columns terminal, this sort of output does not render well
Thanks for that part 2, really does the job for what I need. Basically my brief for the ls -l command is to make it more user friendly, have you any ideas on ways to achieve this. I thought if you could but like a table head above the ls -l command that might help
r = read
w = write
x = execute
- = no access
|USR|GRP|OTR| |File Name|
drwx rwx -wx joebloggs
that was my idea, do you feel this would be user friendly enough?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.