Redirect the standard HCIDUMP output using GREP to a file

1

I'm using a shell script to do HCIDUMP and using some filters to write to a file. With the following command, the destination file is empty.

hcidump -a l2cap | grep -v -e 'CAP' -e 'HCI' > onlystringsrecieved.txt

Using the same command without redirecting the output to a file, it works fine at the LXTerminal command prompt.

hcidump -a l2cap | grep -v -e 'CAP' -e 'HCI'
    
asked by anonymous 26.03.2017 / 05:48

1 answer

0

Probably the output of your interest is not in stdout but in stderr . Redirect stderr to stdout and check if there is any information in the file after the modification:

hcidump -a l2cap 2>&1 | grep -v -e 'CAP' -e 'HCI' > onlystringsrecieved.txt
    
08.06.2017 / 20:02