regex - Detection of pattern in bash -
the file working looks (only last 2 lines shown):
[16]((((((((((648:0.0167313,(((839:0.00281972,903: [62](((909:0.00419522,895:0.00419522):0.004454hgip: 76898
in bash, how check whether last line contains string hgip
- , if does, replace last line after [] expression line above (the penultimate line) this:
[16]((((((((((648:0.0167313,(((839:0.00281972,903: [62]((((((((((648:0.0167313,(((839:0.00281972,903:
so number should retained original rest of line copied penultimate line. numeric @ beginning of line not 2 characters long length. after braces there (
.....
like:
sed -n '/hgip/{s/].*/]/;g;s/\n//g};p;{s/\[[0-9]*\]//;x}'
Comments
Post a Comment