Redirect standard HCIDUMP output using GREP to a file

Asked

Viewed 60 times

1

I am 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, works normal at the Lxterminal command prompt.

hcidump -a l2cap | grep -v -e 'CAP' -e 'HCI'
  • you have write permission to create "onlystringsrecieved.txt" ? which error message appears?

1 answer

0

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.