hello,
case: sed on a system doesn't support -i
I need to remove leading hashe(s) from matched patern lines in a file.
I can sed + temp file but how could I skip temp file and do change it directly in text file?
Code:
$ echo " ############# 456\n\t ## 12345 \t\n 2345 # ## ####12345#\t aa\n%### \t12345 bb\n11 22 33 44 55"
############# 456
## 12345
2345 # ## ####12345# aa
%### 12345 bb
11 22 33 44 55
$ D=12345
$ echo " ############# 456\n\t ## 12345 \t\n 2345 # ## ####12345#\t aa\n%### \t12345 bb\n11 22 33 44 55"|sed "/${D}/ s/^[[:space:]]*//;/${D}/ s/[[:space:]]*$//;/${D}/ s/[[:space:]][[:space:]]*/\ /g;/${D}/ s/^#[# ]*//"
############# 456
12345
2345 # ## ####12345# aa
%### 12345 bb
11 22 33 44 55
$