I have edited a StatTransfer notepad file with 22,000 lines of value labels commands, but which now hundreds of blank lines. There is no filter under Edit. Is there a quick way to delete the blank lines from the file so they can be copied to SPSS syntax? Thanks in advance. John F Hall (Mr) [Retired academic survey researcher] Email: [hidden email] Website: www.surveyresearch.weebly.com SPSS start page: www.surveyresearch.weebly.com/1-survey-analysis-workshop |
I would recommend that you install the free Notepad++ (Google for it). It is much more powerful than Notepad, including the ability to remove blank lines (replace \r\n\r\n with \r\n). On Thu, May 26, 2016 at 1:00 PM, John F Hall <[hidden email]> wrote:
|

John & Jon,
Deleting blank lines in ordinary Notepad is a
PITA, as this
six year old discussion on the Superuser
website shows; see:
If for some reason you feel compelled to use
Notepad, there
is a macro creator called autohotkey (referred
to in the discussion
above) which would allow you to continue to
use Notepad.
For more info on Autohotkey, see:
If the prospect of downloading new software
terrifies you, note
that near the bottom of the discussion on
Superuser is a step-by-step
procedure on how to use Excel to get your
blank lines deleted
(I haven't tried it but if you have Excel it
might be worth a try).
I agree with John that Notepad++ is a much
better editor and
will do what you want. Open the file in
Notepad, click on Edit
on the Menu bar at top, click on line
operations on the drop-down
menu, and then you have two options to delete
blank lines in the
second dropdown menu. CNET's download
website has it
and you can read some of the reviews about
Notepad++ there;
see:
NOTE: the Superuser website shows and example
using Notepad++
but the version being used appears to be
different -- not surprising
given that the discussion is six years
old.
HTH
-Mike Palij
New York University
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
In reply to this post by John F Hall
Jon has suggested getting another text editor. Another option would be to open your text file with Word, and follow the instructions here:
http://paul.us2uk.eu/index.php/2013/12/09/how-to-delete-blank-lines-in-a-word-document/ I.e., CTL-H, and replace ^p^p with ^p. HTH.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Thanks to everyone for the useful tips. Funnily enough, before I saw Bruce’s message, I’d already thought of that when I woke up at 04:25 (insomnia brought on by too much screen-watching?). I’d already used Ctrl+A to copy the StatTransfer output to notepad before editing value labels for 2905 vars, but this left blank lines. Tried to get rid of them using Ctrl+H, but couldn't, so Ctrl+A copied Ctrl+A into a new Word file and used Ctrl+H to replace [^p^p] with [^p] and in one instance [4 spaces^p] with [^p]. As well as single blank lines, there were a few multiples, so I had to repeat a few times to get 1830, 2, 205, 1821, 1, 1, 1 replacements. I should explain that this syntax was only for value labels. When I copied it into SPSS syntax and ran it, I got errors because there are a load of string variables in the file, so I had to backtrack, locate the string vars and skip them. That has taken all morning, but it’s now a load off. Missing values are now more or less OK, but there is still the headache of resetting thundreds if not thousands of incorrect measurement levels. There is a large number of nominal level variables which are binary or partially ordered (Nominal categories which can be recoded to make them Ordinal). It would be useful to have subcategories of Measure > Nominal > Binary or Partially ordered, analogous to Type > Numeric > Date. Perhaps this could be done by adding attributes? Again, thanks to everyone for all their contributions under this and earlier threads: the SPSS-X list is a great resource. John F Hall (Mr) [Retired academic survey researcher] Email: [hidden email] Website: www.surveyresearch.weebly.com SPSS start page: www.surveyresearch.weebly.com/1-survey-analysis-workshop |
paste to Wordperfect
find [Hrt][Hrt] replace with [Hrt] do this several times click go to to to search for the find string. (This takes care of multiple hard returns in a row). then because some file transfers use a single space with a hard return for a blank line find [Hrt] [Hrt] replace with [Hrt] i.e., a space between [Hrt] space [Hrt] do this several times click go to to to search for the find string. (This takes care of multiple single space hard returns in a row).
Art Kendall
Social Research Consultants |
There's a lot to be said for using the appropriate tool. In Notepad++, doing replace (\r\n)+ with \r\n with regular expressions enabled gets rid of single or multiple empty lines in one step, and this could be generalized to handle different types of line endings as a single operation. On Sat, May 28, 2016 at 7:58 AM, Art Kendall <[hidden email]> wrote: paste to Wordperfect |
Free forum by Nabble | Edit this page |