substring - Shell Scipt sub string -
please me script below case.
i have content of file below,
allidpropert.txt (id|propertybit|)
1|0000000000000000000000000| 2|0000100000000000000000000| 3|0000100000000000000000000| 4|0000100000000000000000000| 5|0000000000000000000000000| 6|0000000000000000000000000|
i need extract id's different file propertybit[5] == 1(where 5th bit 1) in format below.
5bitenable.txt
2| 3| 4|
`
this awk one-liner should job:
awk -f'|' 'substr($2,5,1)==1 {print $1fs}' file
test example input:
kent$ awk -f'|' 'substr($2,5,1)==1 {print $1fs}' f 2| 3| 4|
Comments
Post a Comment