mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-25 22:07: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:
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user