Page 1 of 1
Duplicate lines
Posted: Fri Jan 18, 2008 6:27 pm
by canis
For example I have this text:
line1
line2
line3
...
lineN
I need it to become:
line1=line1
line2=line2
line3=line3
...
lineN=lineN
I use this perl pattern: search ^(.*)$ - replace with $1=$1 (thanks to support team), but I have this:
line1
=line1
line2
=line2
line3
=line3
....
How to join lines by pair?
Check the Perl matching options
Posted: Fri Jan 18, 2008 6:44 pm
by dfhtextpipe
Turn off . matches New Line
Posted: Fri Jan 18, 2008 6:49 pm
by canis
Excuse me, where is it?
P.S. ok, I've found. But lines have no dots at the and.
Solution found - tested with some random data - this works
Posted: Fri Jan 18, 2008 8:33 pm
by dfhtextpipe
Use the
copy fields filter, with an
equals sign as the custom delimiter....
Code: Select all
TextPipe Single User Edition
Filter Title: Solution
Filter List
-----------
Filter options
| [ ] Log to file
| [X] Append to logfile
| Log filename: textpipe.log
| Threshold 500
|
|--Input from file(s)
| [ ] Confirm before processing each file
| [ ] Confirm before processing read/only files
| [ ] Delete input files after processing
| Process binary files
|
|--Comment...
|
|--Copy fields:=-delimited field 1 .. field 1 copy to 2
| Delimiter Type: 5
| Custom delimiter: =
| [ ] Has Header
|
+--Output to file(s)
[ ] Only update date on changed files
[X] Keep original file's date and time
[ ] Append mode
[X] Change extension to: .try.txt
Restrictions
You would need to ensure that the original data does not contain any = characters.
If this is not true, you could choose a different delimiter, one that your data never contains, then use an
exact replace filter to change it from that to =.
Posted: Fri Jan 18, 2008 8:56 pm
by canis
Thanks, I've just replaced carriage return with "nothing".