Reputation: 407
I need to replace all patterns of either AllowUsers
, #AllowUsers
or # AllowUsers
in a file.
I've got that part covered with sed -e 's/^\s*#\?AllowUsers.*//'
But the thing I'm having trouble with is that it should leave one occurrence in the file and remove everything else.
Let me know, thank you in advance!
Upvotes: 0
Views: 279
Reputation: 407
awk '/AllowUsers||#AllowUsers||# AllowUsers/&&c++ {next} 1'
did the job!
Upvotes: 1