i have series of line in following format:
line: 5190 stno: 22669 si: voice cct line stno si bus type 003 6269 opti multline 8. . . . . . . . . . . . . . . 001 subunit . . . . . digite main defil/trs (alt_rout: n) (optiip ) line: 5291 stno: 29956 si: voice what need find through regex (notepad++) numbers after "stno:"
there approximately 100 of such matches.
i tired stno:\s+\d{4,5} taking stno match not want. please help.
i need keep matched result , rest want delete or copy matched items new file whichever easier.
i suggest 2 step approach. first lines stno , number. second remove except number.
select mark tab in find dialogue. ensure bookmark line ticked. in find what box enter stno:\s*\d+ , click mark all.
access menu => search => bookmark => copy bookmarked lines. paste buffer. alternatively, work in same file use menu => search => bookmark => remove unmarked lines. should have wanted lines in buffer.
do regular expression search , replace setting find what ^.*stno:\s*(\d+).*$ , replace with \1. click replace all.
the above assumes there 1 number found per line.
=========================
as numbers wanted, method put line breaks plus marker around wanted numbers, delete lines without marker, delete markers.
let marker keep. search , replace setting find what keep , replace with single space character, make sure match case not selected; click replace all. next, regular expression search , replace setting find what ^stno:\s*(\d+) , replace with \r\nkeep\1\r\n. might want match case ticked; click replace all. next mark lines (as described above) find what set keep, followed menu => search => bookmark => remove unmarked lines. finally, search , replace setting find what keep , replace with empty.
Comments
Post a Comment