mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2025-07-04 03:58:49 +02:00
add sed
Remove lines whose nth character not equal to a value
This commit is contained in:
@ -194,6 +194,12 @@ sed "/bbo/d" filename
|
||||
- case insensitive:
|
||||
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)
|
||||
|
||||
|
Reference in New Issue
Block a user