728x90

리다이렉션 2

[리눅스 | Linux] 파이프라인, 리다이렉션 적용 예제

ubuntu@civic-asp:~/colors$ vi colors.txtubuntu@civic-asp:~/colors$ cat colors.txt blueblackredredgreenbluegreenredredblue colors.txt를 생성한다.  ubuntu@civic-asp:~/colors$ favcolors.txtubuntu@civic-asp:~/colors$ lacolors.txt favcolors.txtubuntu@civic-asp:~/colors$ cat favcolors.txt 4 red 3 blue 2 green colors.txt에서 가장 많이 존재하는 색상의 개수와 이름을 상위 3개 추출하는 명령어를 수행한다.   단계적으로 파악하자.     1. c..

[리눅스 | Linux] 리다이렉션 파이프라인

# 리눅스 표준 스트림 동작 과정일반적으로 커맨드command로 실행되는 프로세스process는 표준 입력 스트림standard input stream ; stdin, 표준 출력 스트림standard output stream; stdout과 오류 출력 스트림standard error stream ; stderr을 가지고 있다.기본적으로 이 모든 스트림은 일반적인 문자열plain text로 콘솔console에 출력 하게 되어 있다.   # 리다이렉션표준 스트림의 흐름을 바꿔준다. == 실행된 프로세스의 스트림을 콘솔이 아닌 파일로 사용하고 싶을 경우 사용.기호방향의미>표준 출력명령의 결과를 파일로 저장; 기존 파일 덮어씀>>표준 출력(append)명령의 결과를 기존 파일에 추가표준 입력파일의 데이터를 명령..

728x90