This may not be the shortest, but should be easy to understand for anyone with a little bit of awk knowledge.
Up vote 2 down vote favorite share g+ share fb share tw.
CHICONY HP Basic USB Keyboard id=9 slave keyboard (3) And I want to get the id number. I've try something like awk -F 'id=' 'print $2} but text after the id number is still here! How I can only get the id number!
Thanks in advance. Bash scripting shell awk link|improve this question asked Aug 9 '10 at 14:15turlutte111.
This may not be the shortest, but should be easy to understand for anyone with a little bit of awk knowledge: awk '{ for (i = 1; I.
May I suggest: {print substr($i,4); break} in place of your print statement – glenn jackman Aug 9 '10 at 16:33 @glenn jackman Thanks, I added it. – schot Aug 10 '10 at 7:22.
Try: xinput --list | grep -Eo 'id=0-9+' | grep -Eo '0-9+' or xinput --list | grep -Eo 'id=0-9+' | awk -F= '{print $2}.
Nice solution. Requires GNU grep for -o – glenn jackman Aug 9 '10 at 16:31.
One way xinput --list | awk -F"id=" 'NF{split($2,a," ");print a1}' file with the shell(bash) #! /bin/bash xinput --list | while read -r line do case "$line" in *id=* ) line=${line##*id=} echo ${line%% *} esac done.
Try something like this: xinput --list | while read line; do ID=`echo ${line} | cut -d= -f2 | cut -d\ -f1 | xargs` echo ${ID} done.
Thanks it work fine! – turlutte Aug 9 '10 at 14:37 you're welcome :) – ozk Aug 9 '10 at 14:51.
Bash only: while read line ; do if $line =~ id=(:digit:) ; then echo "${BASH_REMATCH1}" fi done.
I find these things simplest with sed, using substitution of a group to capture the data you want and ensuring the rest of the line is matched in the regex. Sed 's/. *id=\(0-9*\).
*/\1.
– Petesh Aug 10 '10 at 14:40 I was basing it on the sample text provided by the poster, but you are correct regarding -n /p - another sed pattern I frequently use. – camh Aug 11 '10 at 0:43.
Try: cat x | awk -Fid= '{print $2}' | awk '{print $1}.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.