Reputation: 39354
I need to do a regex capture/repalce on a file with content like the following. While I'm okay at matching things, I'm having trouble doing a capture replace.
I'd like to do the following:
So, for example, copy mytable(
would become hello mytable\ncopy mytable(
.
Sample Input
copy tablename(
preferredid= 'c0»',
qid= 'c0»' with null(''),
qpi= 'c0»',
ptid= 'c0»' with null(''))...
into '/idata2/backup/core/eq.ingres'
Upvotes: 0
Views: 253
Reputation: 35208
Using a perl one-liner
perl -i -pe 's/^(?=copy (\w+)\()/hello $1\n/' file
Upvotes: 0