ночной бред на тему парсинга

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
fname=access.conf
username=${1:-nazaro}
clear
#grep -E "(\[[a-z]*\])[a-z]*(\[*\])" $fname
#grep -E "(\[[a-zA-Z:/-]*\])([@a-z=]?)" $fname
#grep -En "(\[*\]$)+(*)" $fname
#mas=`
#grep -E '\s*\[*\]\s*' $fname
#echo ${mas[0]}
#echo ${mas[1]}
#\[\w+\]\s+((.*=.*\s+)*|[^\[])
#grep -E "\[\w+\]\s+((.*=.*\s+)*|[^\[])" $fname
awk '
/^\[([a-zA-Z@=]*)$\[/
{RS = "["; print NR, NF, $0}
' $fname
exit
#[Section1]\r\nkey0 = value0\r\nkey1=value1\r\n\r\nkey2= value3 ;comment\r\nkey3 =value2 |
#echo $col
groups=(`awk '/'$username'/{print $1}' $fname` )
for group in ${groups[*]}; do
#echo $group;
#$echo $fname
awk '/^@'$group'/{print}' $fname
done
exit
#!/bin/sh
#echo $1
#username=$1
#echo $username
#awk '//{print $1}'
username=${1:-1}
awk '/$'$username'/{print $username}' access.conf
#!/bin/sh
column=$1
awk '{print $'$column'}'
#echo $username
#awk '/naza/{print $1}' access.conf
#awk '/$'$username'/{print}'
#|xargs
#grep access.conf -e
#exit
#m=`cat access.conf | awk '/vnazarov/{print $1}'`
#echo $m
#for i in $m do
# grep access.conf -e {$i}
# echo $i
#done