help to delete some blank lines
-
hello to everybody,
i have some documents with up to 10K lines like this one:
text-001 text-002 https://www.486905968046wdGtqQT09/74662-7z https://www.ajjdhflfkgwdGteds/74662-7z https://www.erlkjglegio45gio8/74662-7z text-003 text-004 https://www.lSHM3UmJ2MW1rcEh3QT13/1982827-7z text-005 text-006 https://www.tVbkQxTmd2a0lYMVc28193/1quehhs-rar https://www.kfjdhdh7742222/1quehhs-rar https://www.949iwjdjnnssbabqq/1quehhs-rar
i need to delete blank empty lines only on https lines, like this:
text-001 text-002 https://www.486905968046wdGtqQT09/74662-7z https://www.ajjdhflfkgwdGteds/74662-7z https://www.erlkjglegio45gio8/74662-7z text-003 text-004 https://www.lSHM3UmJ2MW1rcEh3QT13/1982827-7z text-005 text-006 https://www.tVbkQxTmd2a0lYMVc28193/1quehhs-rar https://www.kfjdhdh7742222/1quehhs-rar https://www.949iwjdjnnssbabqq/1quehhs-rar
how to?
or another solution: delete all blank lines, but then add new blank lines only between https link and text-00n -
Hello, @namx3249 and All,
As usual, not difficult with the appropriate regex expression
So, starting with your INPUT text, where I added a leading TAB char before the first part of your text :
text-001 text-002 https://www.486905968046wdGtqQT09/74662-7z https://www.ajjdhflfkgwdGteds/74662-7z https://www.erlkjglegio45gio8/74662-7z text-003 text-004 https://www.lSHM3UmJ2MW1rcEh3QT13/1982827-7z text-005 text-006 https://www.tVbkQxTmd2a0lYMVc28193/1quehhs-rar https://www.kfjdhdh7742222/1quehhs-rar https://www.949iwjdjnnssbabqq/1quehhs-rar
the following regex S/R :
SEARCH
(?-s)^(.+\R)\R+(?=[\t\x20]*http)
REPLACE
\1
Will produce your expected OUTPUT text :
text-001 text-002 https://www.486905968046wdGtqQT09/74662-7z https://www.ajjdhflfkgwdGteds/74662-7z https://www.erlkjglegio45gio8/74662-7z text-003 text-004 https://www.lSHM3UmJ2MW1rcEh3QT13/1982827-7z text-005 text-006 https://www.tVbkQxTmd2a0lYMVc28193/1quehhs-rar https://www.kfjdhdh7742222/1quehhs-rar https://www.949iwjdjnnssbabqq/1quehhs-rar
Best Regards,
guy038
-
oh guy038, as usual your regex work fine!
thanks you so much. you saved my dayonly don’t understand why have you add a leading TAB on first block … it work fine also without this …
-
Hi, @namx3249 and All,
Ah…, I simply added a leading
TAB
char before each line of the first part to show you that the regex S/R could also handle this case !But, If you’re sure that leading blank chars won’t appear in your file, you can simplify the regex S/R as below, to get a similar OUTPUT :
SEARCH
(?-s)^(.+\R)\R+(?=http)
REPLACE
\1
BR
guy038