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

(새 문서: ==개요== ;리눅스 여러 줄 출력을 한줄로 만들기 <source lang='console'> root@localhost:~# cat a.txt hello world lorem ipsum </source> {{소스헤더|스페이스 구...)
 
 
(다른 사용자 한 명의 중간 판 하나는 보이지 않습니다)
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>




34번째 줄: 34번째 줄:
[[분류: sed]]
[[분류: sed]]
[[분류: xargs]]
[[분류: xargs]]
[[분류: 리눅스 멀티라인]]

2020년 12월 21일 (월) 11:50 기준 최신판

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 }}