Hi,
Below is the code i am using. On console output is fine but when i am redirecting output to file then single line is breaking in multiple lines. Please help.
for dir in */; do printf "%s, " "$dir"; ls -m "$dir"; done
**Output on Consloe : **
buckets/, apr_bucasdfsadfa_fasdfasfaool.lo, apr_buckets_simpleapr_buckets_simple.lo, apr_buckets_socketapr_buckets.lo, apr_buowekrfwqereqjncckets_reqwer.lo
build/, config_vars.sh.in, export_varsexport_varsexport_vars.pl, mkdepphf_abuse_logphf_abuse_logp.perl, rules.mksocketapr_buckets.insocketapr_buckets
include/, util_md5util_md5util.h, util_scriptutil_scriptutit.h, util_timeutil_hutil_time.h, util_xmlutil_xml.h
os/, ap_regkeyap_regkey.c, MakefileMakefile.in, MakefileMakefileMake, osabuse_logabuse_log.h
server/, export_filesexport_files, export_vars.hexport_vars.h, httpd.exphttpd.exp, libmain.lalibmain.la
support/, logresolve.pllogresolve, log_server_statuslog_server_status, phf_abuse_phf_abuse_log.cgi, split-logfilesplit-log
cat output.txt
Output in file
buckets/, apr_bucasdfsadfa_fasdfasfaool.lo, apr_buckets_simpleapr_buckets_simple.lo,
apr_buckets_socketapr_buckets.lo, apr_buowekrfwqereqjncckets_reqwer.lo
build/, config_vars.sh.in, export_varsexport_varsexport_vars.pl,
mkdepphf_abuse_logphf_abuse_logp.perl,
rules.mksocketapr_buckets.insocketapr_buckets
include/, util_md5util_md5util.h, util_scriptutil_scriptutit.h,
util_timeutil_hutil_time.h, util_xmlutil_xml.h
os/, ap_regkeyap_regkey.c, MakefileMakefile.in, MakefileMakefileMake,
osabuse_logabuse_log.h
server/, export_filesexport_files, export_vars.hexport_vars.h, httpd.exphttpd.exp,
libmain.lalibmain.la
support/, logresolve.pllogresolve, log_server_statuslog_server_status,
phf_abuse_phf_abuse_log.cgi, split-logfilesplit-log