mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-26 06:17:01 +00:00
add sed
Remove lines whose nth character not equal to a value
This commit is contained in:
parent
d21abd8ddc
commit
99b7c30807
@ -194,6 +194,12 @@ sed "/bbo/d" filename
|
|||||||
- case insensitive:
|
- case insensitive:
|
||||||
sed "/bbo/Id" filename
|
sed "/bbo/Id" filename
|
||||||
```
|
```
|
||||||
|
##### Remove lines whose nth character not equal to a value (e.g. 5th character not equal to 2)
|
||||||
|
```bash
|
||||||
|
sed -E '/^.{5}[^2]/d'
|
||||||
|
#aaaa2aaa (you can stay)
|
||||||
|
#aaaa1aaa (delete!)
|
||||||
|
```
|
||||||
|
|
||||||
##### Edit infile (edit and save)
|
##### Edit infile (edit and save)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user