ls command!!!
Hi Friends,
I have a question about ls command. #ls -l x y z #ls -m x, y, z But my question is to print the output like: x, y and z. What approach should I be using to get the exact result? Thanks- |
Do you have reason to believe that ls will do that? The man page does not seem to include that option.
I'm guessing that you will have to pipe the output into another command (eg SED). |
Now it can be done like this:--
[test@gfmdatabase test]$ y=`ls -m try`;echo "${y%,*} and ${y##*,}" hello and script1 Thank you!! |
And here is a SED solution:
ls -m|sed 's/ \([^,]*\)$/ and \1/' |
All times are GMT -5. The time now is 06:56 AM. |