Bash Sed Pipe to Command One-Liner

사용자 3063045

모든 인터페이스에서 출력을 덤프하려고합니다. 이것이 내가 지금까지 얻은 것입니다.

ifconfig | awk '{print $1}' | sed s'/.$//'

나는 다음과 같은 것을 갖고 싶다.

ifconfig | awk '{print $1}' | sed s'/.$//' | tcpdump -i {} -c 1

여기서 {}는 파이프에서 전달되는 것입니다.

최신 정보:

다음은 ifconfig의 샘플 출력입니다.

em0 : 캡슐화 : 에테르; 프레이밍 : 에테르
        플래그 = 0x3 / 0x8000 
        현재 미디어 : i802 2 : 0 : 0 : 1 : 0 : 4
em0.0 : 플래그 = 0x8000 
        inet primary person 1500 local = 129.16.0.1 dest = 128.0.0.0 / 2 bcast = 191.255.255.255
        tnp primary mtu 1500 local = 17825796

awk는 tcpdump에 전달해야하는 인터페이스 이름을 출력합니다.

위 코드의 동등한 실행은 다음과 같습니다.

tcpdump -i em0
tcpdump -i em0.0

한 줄로 tcpdump로 파이프 아웃하려면 어떻게해야합니까?

게스트 VM
ifconfig | grep -Po "^ [^ \ s :] +"| 읽는 동안 if; tcpdump -i $ if; 끝난
# tcpdump -i em0
# tcpdump -i em0.0

tcpdump`ifconfig | grep -Po "^ [^ \ s :] +"| sed "s / ^ /-i /"`
# tcpdump -i em0 -i em0.0

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Bash Sed Pipe to Command One-Liner

분류에서Dev

One Liner sed date string to unixtime

분류에서Dev

sed One-Liner를 Perl로 변환

분류에서Dev

sed one-liner를 awk로 번역

분류에서Dev

Why's this shutdown one-liner command not working

분류에서Dev

Execute sed command in a bash script

분류에서Dev

sed 및 perl one-liner로 csv를 구문 분석합니까?

분류에서Dev

One liner variable declaration

분류에서Dev

sed multiple entries in one command to remove data

분류에서Dev

sed command works in terminal but not through bash_aliases or a bash script

분류에서Dev

What is an efficient BASH one-liner for adding line every 130 characters to a file without lines?

분류에서Dev

awk / sed / perl one liner + json 파일에서 속성 줄만 인쇄하는 방법

분류에서Dev

Sed command garbled with very easy mutiline regex in bash

분류에서Dev

Bash- awk one liner {텍스트 파일의 세 번째 줄마다 인쇄}

분류에서Dev

기본값을 얻기 위해 bash one-liner를 강화하는 방법

분류에서Dev

how to read files listed by ls command one by one in bash?

분류에서Dev

sed 또는 perl one line liner를 사용하여 선을 왼쪽에 정렬하는 방법

분류에서Dev

sed 또는 perl one line liner를 사용하여 선을 왼쪽에 정렬하는 방법

분류에서Dev

Extracting values from a text file having | pipe as a delimiter in text file using awk command and Replacing new lines with <br> tag using sed?

분류에서Dev

Bash: Pipe output into a table

분류에서Dev

Bash one liner는 작동하지만 스크립트는 작동하지 않습니다.

분류에서Dev

bash-sed : -e expression # 1, char 15 : unterminated`s 'command

분류에서Dev

Sed command does not execute correctly when called from bash script and works fine when called from prompt

분류에서Dev

Pipe lines of text into a linux command

분류에서Dev

A pipe command doesn't work

분류에서Dev

Execute a command within 'sed'

분류에서Dev

sed next & Next command

분류에서Dev

sed command with option -n and '$='

분류에서Dev

sed command to replace a line

Related 관련 기사

  1. 1

    Bash Sed Pipe to Command One-Liner

  2. 2

    One Liner sed date string to unixtime

  3. 3

    sed One-Liner를 Perl로 변환

  4. 4

    sed one-liner를 awk로 번역

  5. 5

    Why's this shutdown one-liner command not working

  6. 6

    Execute sed command in a bash script

  7. 7

    sed 및 perl one-liner로 csv를 구문 분석합니까?

  8. 8

    One liner variable declaration

  9. 9

    sed multiple entries in one command to remove data

  10. 10

    sed command works in terminal but not through bash_aliases or a bash script

  11. 11

    What is an efficient BASH one-liner for adding line every 130 characters to a file without lines?

  12. 12

    awk / sed / perl one liner + json 파일에서 속성 줄만 인쇄하는 방법

  13. 13

    Sed command garbled with very easy mutiline regex in bash

  14. 14

    Bash- awk one liner {텍스트 파일의 세 번째 줄마다 인쇄}

  15. 15

    기본값을 얻기 위해 bash one-liner를 강화하는 방법

  16. 16

    how to read files listed by ls command one by one in bash?

  17. 17

    sed 또는 perl one line liner를 사용하여 선을 왼쪽에 정렬하는 방법

  18. 18

    sed 또는 perl one line liner를 사용하여 선을 왼쪽에 정렬하는 방법

  19. 19

    Extracting values from a text file having | pipe as a delimiter in text file using awk command and Replacing new lines with <br> tag using sed?

  20. 20

    Bash: Pipe output into a table

  21. 21

    Bash one liner는 작동하지만 스크립트는 작동하지 않습니다.

  22. 22

    bash-sed : -e expression # 1, char 15 : unterminated`s 'command

  23. 23

    Sed command does not execute correctly when called from bash script and works fine when called from prompt

  24. 24

    Pipe lines of text into a linux command

  25. 25

    A pipe command doesn't work

  26. 26

    Execute a command within 'sed'

  27. 27

    sed next & Next command

  28. 28

    sed command with option -n and '$='

  29. 29

    sed command to replace a line

뜨겁다태그

보관