
October 11th, 2012, 12:42 PM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 2
Time spent in forums: 16 m 7 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by spacebar208 You could use grep, For example:
Code:
echo "Hallo da. Ich bin Rolf. Ich arbeite hier. Tolle Sache." | grep -Go '\(Ich.\{1,\}\)\(Ich.\{0,\}\)'
Ich bin Rolf. Ich arbeite hier. Tolle Sache.
|
Thanks. Given that I wanted this in an awk script, I couldn't straightforwardly use grep. Your comment, however, did make me realize that grepping, rather than subbing was the right thing to do.
This seems to work fine now:
Code:
awk 'match($0,/Ich (arbeite|bin).*/) {print substr($0,RSTART,RLENGTH)}' txt.txt
|