Use awk to find first occurrence only of string after a delimiter
问题 I have a bunch of documents that all have the line, Account number: 123456789 in various locations. What I need to do is be able to parse through the files, and find the account number itself. So, awk needs to look for Account number: and return the string immediately following. For example, if it was: Account number: 1234567 awk should return: 1234567 Once it's found the first occurrence it can stop looking. But, I'm stumped. What's the right way to do this using awk ? 回答1: One way: awk -F: