awk实现 文本内的换行符 为分隔符,输出变为逗号

时间:2022-10-30 20:31:39

awk实现 文本内的换行符 为分隔符,输出变为逗号

[liujianzuo@ow2 scripts]$ awk -F $ '{print $0}' ldap_member.log
ruanshujun
zouwei
chenyongkang
qudeng
liukangqiang
guolina
huangxiaojuan
zhaoxueying
heting
huqiang
wangning
tanqingbin
guosongdian
huangxiaoling

[liujianzuo@ow2 scripts]$ awk 'BEGIN{ORS=","}{print $0}' ldap_member.log
ruanshujun,zouwei,chenyongkang,qudeng,liukangqiang,guolina,huangxiaojuan,zhaoxueying,heting,huqiang,wangning,tanqingbin,guosongdian,huangxiaoling,hansifang,zhangsujing,xuepeng,zhangshumin,liyuanjun,dailiangbin,yuanying,wangqiumei,zhanzhisong,shenxiaoying,liuxiaojuan,wangduo,xuyuanyuan,lihanchen,zhangyulong,baihan,zhenyanli,kangting,wangdan,maoaihui,jiaowei,baisa,yangjingwei,wangbing,shirunfeng,chenliping,yuanchao,huanghaoran,wangna,zhaoyingzong,zhouliwen,hanshiwen,zhangpengcheng,liuyanni,wangjiao,duziran,hebojian,sunhuliang,liuyuanyuan,wuhaibing,songdiandong,sunmeihui,