pitagi
1
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin[9:0]
if i find feedthru_pin want to insert !! at the begining of this line
Can some one help?
one way
awk ' if(index($0,"feedthru_pin")>0) {printf("!!")}
print $0 ' infile > outfile
sed '/feedthru_pin/ s#.*#!!&#' infile > outfile
pitagi
4
thanks .. I used sed command it replaces with previous command
ls-VEC(VERILOG) gtfix11/avs_cs_done_cs_feedthru_pin[1:1];
ls was my previous command.
should I try
sed '/feedthru_pin/ s#.*#'!!'&#' infile > outfile
Are you asking something?
I'm confused by the latest post....
pitagi
6
yes. I tried this.
sed '/feedthru_pin/ s#.*#'!!'&#' infile > outfile does not work.
I don't think this is what I put in post - please re-read.
Also for the future, please try elaborating on 'does not work'.
echo "This is a test file" | sed '/test/{
s/^/!!/
}'