![`sed -n '/^#n_sns\tn_loc/,/^[^0-9]/ p' $log_file | grep -E '^[0-9]' > $log_file.sns_p_loc`을 이해하는 방법은 무엇입니까?](https://linux55.com/image/11682/%60sed%20-n%20'%2F%5E%23n_sns%5Ctn_loc%2F%2C%2F%5E%5B%5E0-9%5D%2F%20p'%20%24log_file%20%7C%20grep%20-E%20'%5E%5B0-9%5D'%20%26gt%3B%20%24log_file.sns_p_loc%60%EC%9D%84%20%EC%9D%B4%ED%95%B4%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
튜토리얼을 따르고 있는데 sed 명령이 있습니다.
sed -n '/^#n_sns\tn_loc/,/^[^0-9]/ p' $log_file | grep -E '^[0-9]' > $log_file.sns_p_loc
이해가 안 돼요. 누가 설명해 주실 수 있나요? 아니면 뭔가 문제가 있는 걸까요?
답변1
이것이 도움이 됩니까?
sed -n ' # run sed but don't print by default
/^#n_sns\tn_loc/, # from match 1
/^[^0-9]/ # to match 2
p' # print
귀하의 특별한 질문:
^ # anchor at begin of line
[ # opens a "bracket expression" which normally matches any single character from the list
^ # a leading ^ makes it match any single character NOT from the list.
0-9 # character range, only digits
] # close "bracket expression"
이는 grep
중복된 것처럼 보입니다. 해당 작업(숫자로 시작하는 줄 인쇄) sed
은 먼저 .