Excel related query for the code..need help..

find /A/B/C/{1,3,5,7} -name ".txt" -o -name ".csv" -o -name ".TXT" -o -name ".dat" |xargs ls -ltr |awk '{print $8 ,$9}' > result.xls

it will give the result that is $8 and &9 in the result file...
let say i need the result is a excel file....and i need the result to be print like $8 field should be in the column A and $9 should be print in the B column of in the excel file..

Could any body give some idea on this for the above code...
the above code is giving the result in the column A.

I need the result in different column.

Delimit the $8 and $9 fields by a comma.

Sorry..

i didnt get you man..

could you please help me out again..
thanks in advance..

Hi,

can you given me the view of output that you have...so that hope i can try...

:slight_smile:
:rolleyes:

Hope the below is the one which shamrock said...correct me if am wrong..

if your output looks like below.

columnA columnB
1233 aaaa
2345 bbbb
3455 cccc

the above output is present in file1.txt

then just use the below command to make it csv

sed 's/space/,/g' file1

it should give the output like below
1233,aaaa
2345,bbbb
3455,cccc

or if there are two different column in differnt files then you can use the below command

paste -d, file1 file2 > output.csv

thanks
Sha

2008/home/ADMIN/om/1.txt
20:25/home/ADMIN/om/hi.txt
2008/home/ADMIN/owl/1.txt
but i need like
A B C
2008 /home/ADMIN/om/1.txt
20:25 /home/ADMIN/om/hi.txt
2008 /home/ADMIN/owl/1.txt

2008 /home/ADMIN/om/1.txt
20:25 /home/ADMIN/om/hi.txt
2008 /home/ADMIN/owl/1.txt

This part will come in A column

2008
20:25
2008

the below part will come in column B
/home/ADMIN/om/1.txt
/home/ADMIN/om/hi.txt
/home/ADMIN/owl/1.txt

please try the below one..and let me know :slight_smile:

if the directory start with /home only then please use the below one

sed 's:/:,/home:g' file1.txt > output.csv

let me know if this is working

Thanks
Sha

please try the below one..and let me know

if the directory start with /home only then please use the below one

sed 's:/:,/home:g' file1.txt > output.csv

Thanks
Sha

small change..

that should be..

sed 's:/home:,/home:g' file1.txt > output.csv

:slight_smile: