Link to home
Start Free TrialLog in
Avatar of zhshqzyc
zhshqzyc

asked on

A sed file

Hi, I have an self-training practice Trainingon bash command which needs help from you. Thank you in advance.
A long listing of the root directory, /, is used for input. Create a file holding sed commands that check for symbolic links and plain files. If a file is a symbolic link, precede it with a line "--This is a symlink--". If the file is a plain file, add a string on the same line, adding a comment like "<--this is a plain file".

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of point_pleasant
point_pleasant
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Maciej S
Works with GNU sed only (should be available in all linux distros).
Need some changes in other sed versions (in solaris for example).
ls -l / | sed '/^-/s/$/ <-- this is a plain file/;/^l/i\--This is a symlink--'

Open in new window