need to explain bash grep regular expression grep -E '(^|[^0-9.])'2 *.c -
i'm confused grep command. explain me.
for each digit i, search (nondigit)i sequence in textd.sh)
grep -e '(^|[^0-9.])'i *.c in 0 1 2 3 4 5 6 7 8 9; grep -e '(^|[^0-9.])'$i *.c > lines_with_${i} done
this grep
command:
grep -e '(^|[^0-9.])'$i *.c
is matching digits 0, 1, 2, 3,.... in loop.
while matching these digits makes sure digits either @ start (^
) or else there non-digit non-dot character before these digits ([^0-9.]
).
so example match:
abc 1 2 def5
and won't match:
abc.1
Comments
Post a Comment