I have the following adb
+ awk
command which will work fine in Linux environment [Ref].
adb shell dumpsys package | awk -v RS='\n +Package' '/android\.permission\.CAMERA/{print $1}'
But I need to run this command in Windows 7 PC which has GnuWin32 Gawk package installed. I can run awk commands from the C:\Program Files (x86)\GnuWin32\bin
folder and run the adb commands from the C:\Program Files (x86)\Android\android-sdk\platform-tools
folder. I need to run the above command and get the list of packages that has the CAMERA permissions allowed.
Setting Windows Environmental Variables for AWKPATH and also in PATH variables didn't work. So I just copied the contents of GnuWin32 gawk's bin
folder and pasted in the platform-tools
folder. But when I run in command prompt I get,
awk: +Package'
awk: ^ invalid char ''' in expression
How can I run the above command in Windows? or What is the correct expression that I can run?
Answer
Try to replace the '
with "
. So that the command looks like,
adb shell dumpsys package | awk -v RS="\n +Package" "/android\.permission\.CAMERA/{print $1}"
Take a look as well: Grep and Awk in Windows Invalid Char in Expression Error
No comments:
Post a Comment