i need to store directory information in a way that i can parse as json.
when i do ls -m it gives me comma separated values but no user/group/size info.
bash-3.2$ ls -mp
100CANON/, 2009-11-27_1540.swf, 2009-11-27_1546.swf, 2009-11-27_1551.swf, 2009-11-30_0149.png, 429355_1.sql,
429355_1.sql.zip, About Stacks.pdf, Acrobat.com.app/
ls -l is problematic to parse.
is there anyway you know that I can get ls -l info as comma(or anything) separated values?
You could use
stat
and define your own output format (see parameter-c
).Example:
just combine the
ls -l
output with some other commands, like thisls -l | tr ' ' ',' | tr '\n' ','
. This way you should get the output you need.