Reputation: 21
My text file is like this:
aa/asdhaetcal02acjjaj 2397 hah|asd93hoa|
azxc./asdh5656al02acj4536|asd93hoa|
azxc./asdhceacjjaj 236y3vh|asd93hoa|
And I want it to be like:
aa./asdhaetcal02acjjaj 2397 hah
hazxc./asdh5656al02acj4536
azxc./asdhceacjjaj 236y3vh
This is just an example. I have over 1k lines. I am looking forward to delete everything from each row after first occurrence of "|"
Upvotes: 2
Views: 638
Reputation: 435
Do a search and replace (control -H) using regular expressions, and use:
\|.*?\|
as your regex, and replace with nothing. That should get rid of each |blahblah|
block.
To erase everything from the first | to the next newline, you can use
\|*.\n
Upvotes: 0
Reputation: 1374
Press ctrl+h and select regular expression
find what: (?-s)\|.*
replace with: nothing
Upvotes: 1