Re: sed script to insert text
From: rakesh sharma (sharma__r_at_hotmail.com)
Date: 09/13/03
- Next message: Michel Schinz: "Scsh (a Unix Scheme shell) FAQ"
- Previous message: David Efflandt: "Re: Bash script to see if PPP link is up..."
- In reply to: Narahari: "sed script to insert text"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Sep 2003 20:11:26 -0700
savithari@yahoo.com (Narahari) wrote in message news:<ae30c156.0309121303.71407dcf@posting.google.com>...
> Hello:
> I have to comment a bunch of lines in my java code. The pattern
> to look for in my case is commitTransaction.
>
> If the line says
>
> super.commintTransaction();
>
> or
>
> obj.commitTransaction();
>
>
> insert // at the beginning of the line making the above lines look
> like
>
> // super.commitTransaction();
>
> // obj.commitTransaction();
>
> Is it possible to do it in sed, if so what is the <b>script</b> and a
> brief explanation would help.
>
> Thanks
> -Narahari
sed -e '/commitTransaction/s:^://:' javafile
## whenever sed sees 'commitTransaction' anywhere in a line, it puts
## '//' at the beginning(specified by the ^) of that line & prints it.
## and the non-matching lines are printed out unaltered.
- Next message: Michel Schinz: "Scsh (a Unix Scheme shell) FAQ"
- Previous message: David Efflandt: "Re: Bash script to see if PPP link is up..."
- In reply to: Narahari: "sed script to insert text"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|