InDesign data merge—"remove blank lines" resulting in extra characters - adobe-indesign

I'm using data merge to import two variables per line, and have checked the "Remove blank lines for empty fields" box. The result is a wealth of extra characters that I can't remove using find-and-replace. Of the 24 lines of variables, typically only three contain text, so the other 21 should be empty lines and be deleted by the "Remove blank lines" option.
Attempting to paste these characters into the "find and replace" field, I see
^|^|^|^|^|^|^|^|^|^|^|^|^|^|
Any suggestions? Thanks

Try doing a regular text find/change.
In the Find What field, type < FEFF > (but delete the spaces before and after those angle brackets – the Stack Overflow editor seems to delete this if there are no spaces).
In the Change To, leave blank, and click change all.

Related

Remove duplicates lines but not blank lines in Sublime Text

I know that you can remove duplicate lines by doing Edit>Permute Lines>Unique. But that will remove blank(empty) lines. I would like not to remove them, so blank lines will stay(essentially empty space).
You can do this using Permute Selections. First, open the Find menu (CtrlF or Find → Find…) and make sure the Regex, Wrap, and Highlight matches buttons are selected. In the search field, enter ^.+\n. This matches the beginning of the line ^, 1 or more characters of any type .+, and the newline character(s). Therefore, it will select any line that is NOT just a newline. Note that this will select lines that contain only whitespace, for example a tab character followed by a newline.
Next, hit the Find All button to select each line individually.
Finally, select Edit → Permute Selections → Unique and all duplicate lines will be erased, leaving all blank lines behind.

Notepad++ search by ignoring whitespace?

Dreamweaver has a very convenient search option at its "Find and Replace" dialog called "Ignore whitespace".
By checking that, you can find the same text no matter how many new lines, tabs or spaces you add or remove. All these variations below are the same text:
search for me please
(adding some blank spaces)
search for me please
(adding a new line)
search for me
please
How can I search with Notepad++ while ignoring all the whitespace?
Actually, it's quite not convenient to do that in notepad++.
1.You can Go to Search -> Replace
2.Select "Regular expression" under Search mode
3.Use \s* to replace space in your sentence for Find what and leave Replace with blank
4.Click Find Next
In your case, input "search\s*for\s*me\s*please" in Find what
'\s*' means any number (even 0) of whitespace characters. Whitespace characters include tab,space,newline and carriage return.

Beyond compare ignore one side comments

I found some instructions on how to show/hide differences in comments using beyond compare. However most of the answers show how to set comment as important text or not. That is, if a portion of code is commented on both sides then check if the comment are different or not.
I would like to ignore when only one side of the comparison is commented. In other words if I have
# # line1
# line2
on one side and
# line1
line2
I would like both lines to be marked as "unimportant differences" (if indeed the text is the same, otherwise to be marked as differences).
Beyond Compare will only compare text if it is of the same grammar element type. If one side is regular code and the other side is a comment, it will always mark it as an important difference.
To make regular text on one side and the same text commented on the other side show as a match, you'll need to edit the definition of a comment in the file format.
To edit a format, open Tools > File Formats.
Select the format that matches your files.
Go to the Grammar tab.
Select the Comment grammar element, which might be defined as # to end of line.
Click the Edit (gear) button.
Set the Category radio button to Basic.
Text matching: ^#\s
Check Regular expression.
Click OK, then Save.
The updated file format will treat # followed by a whitespace character as an unimportant comment, the remaining text in the line will be treated as regular text and compared to the other side.

Notepad++ convert leading spaces to tabs upon entry

Very close to reverse of this question. I prefer coding with 2-whitespace indentation, but need to have files indented with tabs to align with project convention. What I would like to do is preferably automatically convert 2 spaces upon entry to tab symbol in Notepad++ and have the editor configured to tab length of 2.
A possible manual way for doing this could be Edit->Blank Operations->Space to TAB but this converts all of my spaces to tabs, even those of length 1 - which are, for example, spaces between function arguments, not just leading spaces.
In a perfect case scenario I'm trying to achieve formatting style as described in this question, but with typing just spaces and the editor taking care of the rest.
I'm on Notepad++ 6.0, but willing to upgrade if this helps
Let me complete the answer of Ari Okkonen to add a workaround to the problem commented by Sergii Zaskaleta of mixed tabs and spaces at the beginning of the line.
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)
Select a block of lines of text with the problem of mixed spaces and tabs. Press [Tab] and [Shift]+[Tab] to add and remove a tab from each line. In the process, the leading spaces had been converted to tabs.
A manual way that seems to work: After having edited the file before saving you may try (Works in Notepad++ v6.8.3):
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)

Blank lines on text box widget

I have an issue with getting the contents of a tkinter text box. If I paste information into it from Excel (for example), it always adds an empty line at the bottom. I would like to remove that line automatically. This is what I use to get the contents:
contents = inputText.get(1.0, "end-1c")
for line in contents.split("\n"):
line = line.strip()
I initially added a '[:-1]' on the end of that, which works, but only on text that is pasted into the text box. If you type text in manually, then obviously there's no trailing '\n' on the end, so it ends up removing the last character that was typed. Not good!
How can I get it to remove (or ignore) the trailing empty lines? The 'line = line.strip()' in the code further down seems to have no effect.
Thanks, Chris.
Your problem isn't with getting the text, your problem is that pasting seems to add more than you expect. To get text, regardless of how it ended up in the widget, you should use .get("1.0", "end-1c"). There is simply no way to know at the time you are getting the contents of the widget if any extra newlines came from the user directly or from a paste operation. To tkinter, text is text no matter how it was entered.
The only solution is to adjust the paste binding, and even that is problematic because I don't think tkinter has any way of knowing if the clipboard contents are from excel, or from some other source.
If all you really want is to ignore all trailing blank lines, call strip() on the data before calling split("\n")
Textbox was always inserts a blank line at the end. The problem was compounded when editing textbox and yet another blank line was inserted. However during edit you could remove blank lines so you can't use "end-1c" all the time.
The trick was to remove 1 or more extra blank lines after editing:
# Rebuild lyrics from textbox
self.work_lyrics_score = \
self.lyrics_score_box.get('1.0', tk.END)
while self.work_lyrics_score.endswith('\n\n'):
# Drop last blank line which textbox automatically inserts.
# User may have manually deleted during edit so don't always assume
self.work_lyrics_score = self.work_lyrics_score[:-1]
Note however this is with Linux. For Windows you might need something like:
while self.work_lyrics_score.endswith('\n\r\n\r'):
# Drop last blank line which textbox automatically inserts.
# User may have manually deleted during edit so don't always assume
self.work_lyrics_score = self.work_lyrics_score[:-2]
Or whatever the the control code is for DOS/Windows LF/CR (Line Feed / Carriage Return) typewriter days style is.

Resources