Question: I'm using `find /usr/local -ls`. It's showing like below:

```
19799045 4 drwxr-xr-x 9 hduser root 4096 Feb 23 11:00 /usr/local 

```

I have to make the data comma-separated like below:

```
19799045,4,drwxr-xr-x,9,hduser,root,4096,Feb 23 11:00,/usr/local 

```

How to do it?

Answer: 
As a general programming principle, it is much easier to generate data in the format you need than it is to generate it in the wrong format and then translate it.

Since you are already using the non-standard non-portable `-ls` primary anyway, you might just as well use `-printf` instead, if your implementation of `find` has it. Something like this should get you closer to what you need:

```
find /usr/local -printf '%i,%b,%M,%n,%u,%g,%s,%Tc,%h/%f'

```
From another question, you can use the -printf feature

```
find /usr/local -printf "%i,%k,%M,%n,%u,%g,%s,%t,%p\n"

```

Then, you can also choose what features you'd like.