"리눅스 여러 줄 출력을 한줄로 만들기"의 두 판 사이의 차이

(새 문서: ==개요== ;리눅스 여러 줄 출력을 한줄로 만들기 <source lang='console'> root@localhost:~# cat a.txt hello world lorem ipsum </source> {{소스헤더|스페이스 구...)
 
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
2번째 줄: 2번째 줄:
;리눅스 여러 줄 출력을 한줄로 만들기
;리눅스 여러 줄 출력을 한줄로 만들기


<source lang='console'>
<syntaxhighlight lang='console'>
root@localhost:~# cat a.txt
root@localhost:~# cat a.txt
hello
hello
8번째 줄: 8번째 줄:
lorem
lorem
ipsum
ipsum
</source>
</syntaxhighlight>
{{소스헤더|스페이스 구분자}}
{{소스헤더|스페이스 구분자}}
<source lang='console'>
<syntaxhighlight lang='console'>
root@localhost:~# cat a.txt | xargs echo
root@localhost:~# cat a.txt | xargs echo
hello world lorem ipsum
hello world lorem ipsum
</source>
</syntaxhighlight>
{{소스헤더|쉼표 구분자}}
{{소스헤더|쉼표 구분자}}
<source lang='console'>
<syntaxhighlight lang='console'>
root@localhost:~# cat a.txt | xargs echo | sed 's/ /,/g'
root@localhost:~# cat a.txt | xargs echo | sed 's/ /,/g'
hello,world,lorem,ipsum
hello,world,lorem,ipsum
</source>
</syntaxhighlight>
{{소스헤더|구분자 없음}}
{{소스헤더|구분자 없음}}
<source lang='console'>
<syntaxhighlight lang='console'>
root@localhost:~# cat a.txt | xargs echo | sed 's/ //g'
root@localhost:~# cat a.txt | xargs echo | sed 's/ //g'
helloworldloremipsum
helloworldloremipsum
</source>
</syntaxhighlight>





2020년 11월 2일 (월) 02:40 판

1 개요

리눅스 여러 줄 출력을 한줄로 만들기
root@localhost:~# cat a.txt
hello
world
lorem
ipsum
스페이스 구분자
root@localhost:~# cat a.txt | xargs echo
hello world lorem ipsum
쉼표 구분자
root@localhost:~# cat a.txt | xargs echo | sed 's/ /,/g'
hello,world,lorem,ipsum
구분자 없음
root@localhost:~# cat a.txt | xargs echo | sed 's/ //g'
helloworldloremipsum


2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}