I want to find a line that starts with the same word, Cut that line + the next one, Insert it in a new file.
Is there any way to do that?
123 Im a line that always start with 123, I can have spaces in the beginning
234 im the next line that needs to be copied with the above, I can have spaces in the beginning and alternating text
many lines
many lines
123 Im a line that always start with 123, I can have spaces in the beginning
234 im the next line that needs to be copied with the above, I can have spaces in the beginning and alternating text
tried with Macro, but that did'nt work out for me
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hmmm, did not get any mail notification on your last post, so sorry for the late answer.
Well, I cant even remember what exactly I did, but I formatted the txt file in a nice way with NP++
And then i just scripted my way out of the problems with VbScript on an .asp page.
I started reading a bit about Reg exp. but I soon realized that it would be just as easy to use VbScript.
The Data is in all kind of different ways down the txt file, with no specific delimiter telling me where it belongs...... so I had to go complex.
Ended up with 884 lines of code, but that's including all the DB importing
Don't you just love an un delimited txt file :0)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is to give you a clue about what you _can_ do.
In your case: do _not_ use the Recursive Replace option.
You only want the single next line to be appended to the line starting with your "word", to be able to extract only those lines later.
You (may) want to break down the combined lines later again.
This could easily be done by replacing an identifier string you put there in the step before (like "#linebreak#") by a linebreak again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You now have all the lines you want. You can paste them in a new document.
You still have to replace the #linebreak# identifier by real linebreaks again.
Move the cursor back to the top of the document (Ctrl+Home).
Open the advanced replace dialog (Ctrl+R).
In the Find field, enter the identifier:
#linebreak#
In the Replace field, after clearing it, press Ctrl+M or Ctrl+Enter.
Uncheck regular expression mode.
Replace all occurrences.
Voila!
Let me collect te credits on this one!
A quicker way would be to insert _two_ #linebreak# identifiers, one for each wanted line, with a real linebreak in-between them.
In the _advanced_ Replace dialog you could just enter:
In the Find field, enter:
^ *(123.*)[^1][^2]$
In the Replace field, enter:
\1#linebreak#
#linebreak#
Of course, you have to press Ctrl+M or Ctrl+Enter after the first #linebreak#.
This will add an identifier to each line starting with 123 and insert an identifier before each following line.
You can select all lines again as described above.
Still, you have to remove all identifiers again after pasting the contents into a new document.
Magic explanation of the regular expression:
^________ look for the start of a line
*_______ accept any space characters before the keyword
123______ the keyword: the first word or string on the line
.*_______ accept any character following the keyword = the whole line
(123.*)__ group this expression to be able to re-place the match
Now we _are_ at the end of the line, but we have to include the linebreak to do the magic.
[^1]_____ match any character not 1
[^2]_____ match any character not 2
This will (only?) work with "not" matches and is just also including the CR LF linebreak characters.
$________ match the end of the line
I think I just noticed this last one isn't even necessary (in this case).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Find and replace do not work in Macros. It hasn't been implemented just yet.
The Regular Expression mode in Find and Replace (Ctl/H) works on only single lines. Volunteer, Fool4UAnyway, has some techniques for dealing with multi line edits. These techniques use the Find and Replace feature in plugin TextFX (see the Wiki page http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo ) . To do the 'cut' that you require, you must use the plugin TextFX Viz functions.
In summary, N++ has no easy method of doing what you want, as you described the problem, but using some ingenuity it is possible.
Now, the ability to edit based on existing strings is very dependent on the nature of those strings. If you could give us some specific examples of the strings, we may be able to spot something inherent in the find strings that will make the job easier.
You wrote:
<quote>
123 Im a line that always start with 123, I can have spaces in the beginning
234 im the next line that needs to be copied with the above, I can have spaces in the beginning and alternating text
<end-quote>
Sorry, these descriptions are not clear enough, especially the bit about 'I can have spaces'.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
490 Lackierung
LACKIERUNG IN "GLANZSCHWARZ" WIE SCHL.NR. 668
490 Lackierung
LACKIERUNG IN "BRILLANTROT" WIE SCHL.NR. 308 SCHL.NR. 905 FüR VORFüHRFAHRZEUG (IAA-FRANKFURT) -VARTA-BATTERIE -BEREIFUNG MICHELIN
Individualfahrzeugdaten
943 Sondersteuerung
FRONT-, HECK-UND SEITENSCHWELLER IN WAGENFARBE DIAMANTSCHWARZ- METALLIC, WIE SCHL.NR. 181 (OHNE KONTRASTLACKIERUNG)
---
490 Lackierung
BAUABW: B9091.2 B9221.B LACKIERUNG IN "MATTHESBLAU-METALLIC" FE 97-5972 BASF GEM. B 9221.B
---
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
---
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
---
0940 Sonderwunsch
FRONT- UND HECKSCHüRZE SOWIE SCHWELLERVERKLEIDUNGEN O H N E KONTRASTLACKIERUNG.
---
0940 Sonderwunsch
BAUABW: B9223.B RADIO BECKER MEXICO ELECTRONIC CR MIT FREQUENZ-DIVERSITY WIE SCHL.NR. 0670, INKL. HIFI-LAUTSPRECHERSYSTEM WIE SCHL.NR.0676 GEM. B 9223.B
---
490 Lackierung
= Lackierung in lagunengrün-metallic, wie Schl.Nr. 266, gem. B 9208.C
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverkleidung ohne Kontrastlackierung
490 Lackierung
= Lackierung in mauritiusblau-metallic, wie Schl.Nr. 287, gem. B 9207.C
---
0940 Sonderwunsch
= Leuchtweitenregulierung, wie Schl.Nr. 510, gem. B 9230.C
---
0940 Sonderwunsch
= - Dachhimmel, A- und C-Säule in Leder Walknappa schwarz, wie Schl.Nr. 0330 (Bereitstellung erfolgt durch ZS-400) - elektrische Sitzverstellung für Fahrer und Beifahrer, wie Schl.Nr. 458, gem. SA 6518/25
---
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverbreiterungen o h n e Kontrastlackierung
---
490 Lackierung
= Lackierung in gletscherblau-metallic, wie Schl. Nr. 280, gemä� B 9233.C
---
490 Lackierung
= Lackierung in bronzitbeige-metallic, wie Schl. Nr. 0139, gem. B 9228.C
0940 Sonderwunsch
= Fahrer- und Beifahrersitz wie BMW 535i - Lordosenstütze für Fahrer, wie Schl. Nr. 0488
---
I'm so tired right now that I almost fall over, will continue tomorrow.
Almost had it though, using Ctrl-X
Got it to go through the file, but at the end it could not find my expression for F3, and started to copy wild. and only way to kill it was task manager :-(
Appreciate your help :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The \1 (digit one) in the Replace field is meant to re-place the (grouped expression) of the Find field.
I used, to find your matches:
^ *(\d+.*)[^1][^2]
To insert two identifiers at once, without appending both wanted lines, I replaced those with:
\1#linebreak#
#linebreak#
I bookmarked all lines with #linebreak# (as described above).
I copied those lines to a new document.
I removed all #linebreak# identifiers by replacing them with nothing.
This is what I got:
490 Lackierung
LACKIERUNG IN "GLANZSCHWARZ" WIE SCHL.NR. 668
490 Lackierung
LACKIERUNG IN "BRILLANTROT" WIE SCHL.NR. 308 SCHL.NR. 905 FüR VORFüHRFAHRZEUG (IAA-FRANKFURT) -VARTA-BATTERIE -BEREIFUNG MICHELIN
943 Sondersteuerung
FRONT-, HECK-UND SEITENSCHWELLER IN WAGENFARBE DIAMANTSCHWARZ- METALLIC, WIE SCHL.NR. 181 (OHNE KONTRASTLACKIERUNG)
490 Lackierung
BAUABW: B9091.2 B9221.B LACKIERUNG IN "MATTHESBLAU-METALLIC" FE 97-5972 BASF GEM. B 9221.B
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
0940 Sonderwunsch
FRONT- UND HECKSCHüRZE SOWIE SCHWELLERVERKLEIDUNGEN O H N E KONTRASTLACKIERUNG.
0940 Sonderwunsch
BAUABW: B9223.B RADIO BECKER MEXICO ELECTRONIC CR MIT FREQUENZ-DIVERSITY WIE SCHL.NR. 0670, INKL. HIFI-LAUTSPRECHERSYSTEM WIE SCHL.NR.0676 GEM. B 9223.B
490 Lackierung
= Lackierung in lagunengrün-metallic, wie Schl.Nr. 266, gem. B 9208.C
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverkleidung ohne Kontrastlackierung
490 Lackierung
= Lackierung in mauritiusblau-metallic, wie Schl.Nr. 287, gem. B 9207.C
0940 Sonderwunsch
= Leuchtweitenregulierung, wie Schl.Nr. 510, gem. B 9230.C
0940 Sonderwunsch
= - Dachhimmel, A- und C-Säule in Leder Walknappa schwarz, wie Schl.Nr. 0330 (Bereitstellung erfolgt durch ZS-400) - elektrische Sitzverstellung für Fahrer und Beifahrer, wie Schl.Nr. 458, gem. SA 6518/25
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverbreiterungen o h n e Kontrastlackierung
490 Lackierung
= Lackierung in gletscherblau-metallic, wie Schl. Nr. 280, gemä� B 9233.C
490 Lackierung
= Lackierung in bronzitbeige-metallic, wie Schl. Nr. 0139, gem. B 9228.C
0940 Sonderwunsch
= Fahrer- und Beifahrersitz wie BMW 535i - Lordosenstütze für Fahrer, wie Schl. Nr. 0488
Alright?
\d+_____ match any consecutive string of digits, at least one
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Why, well why I have to do all of this is because I'm writing a script that imports it all to a database.
But I'm stuck at all these Lines as they seem to be several database fields put together as to what the costumer the ordered.
So I want to have a look at how many different types of lines that there is, so i can break them up, and put them in to the database as i wish.
But when I think about it, I could just copy a line to a new document, Do a Search and replace for the line i just copied, and replace it with nothing. That could work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Did the trick in NP++
> I'll try TextCrawler also
I guess TextCrawler is the first way to go for this kind of exercises. Notepad++ suits for _editing_ texts, but when you want to extract etc. specific tools like TextCrawler can save a lot of (billions of) time(s).
> You wouldent happen to have a regular expression for putting
> all lines that match each other, underneith each other
I'm not sure if I understand you correctly, but I guess the answer is: no, not in Notepad++.
If you want all similar lines to be near each other, I guess you could use the sort function in the Text FX menu.
If you want to extract all lines, again, I advise to use TextCrawler.
> Why, well why I have to do all of this is because I'm writing
> a script that imports it all to a database.
You might want to import all data first and then simply sort it in the database. That's also quite an intended use.
> So I want to have a look at how many different types of lines
> that there is, so i can break them up, and put them in to the
> database as i wish.
In the database you could use some DISTINCT function.
In Notepad++ you can sort with the option to keep _unique_ lines only.
> But when I think about it, I could just copy a line to a new
> document, Do a Search and replace for the line i just copied,
> and replace it with nothing. That could work.
I guess you mean:
1. moving the first occurrence of a line/type to a new document
2. remove all other occurrences from the first document
The results would be the same.
My advise: use the most simple method.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sonderausstattung
Nr. Beschreibung
301 DIEBSTAHLWARNANLAGE MIT ZV
401 SCHIEBE-HEBEDACH, ELEKTRISCH
415 SONNENSCHUTZROLLO FUER HECKSCHEIBE
423 FUSSMATTEN IN VELOURS
500 SCHEINW.WASCHANL./INTENSIVREINIGUNG
530 KLIMAANLAGE
663 BMW BAVARIA C ELEKTRONIC
944 NACHTRAEGLICHER UMBAU DURCH ZS
----
So why don't i just get rid of all the empty lines
Make it put "LineText"; around every single line that has text
But then it should take the line under, and put it up after itself "Line1";"Line2";"Line3"; until it hits a line that contains "rzeugangabe" (Notice i clipped some of, (Fahrzeugangabe) because some lines is missing the first or two chars.)
That would give me on car on one line with "" around each Entity and seperated by ;
Could import that txt file directly into a db, and then i'm finally at my home base :-) Normalising of the database could begin :-)
Id that even possible?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not taking enough time now to consider (or try to figure out) what you are talking about.
But I guess (something like) that is what I described in the other thread I referred to earlier.
You probably could use the last (two) characters of "Fahrzeugangaben" to make the "Incursive Replacement" method work.
A safer way would be to append a more distinctive identifier to those lines first, so you may be more sure that other lines won't interfere with the magic.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, I guess. I didn't (take a) look back after my post. There wasn't a reply to it either.
Perhaps if you gave an exact example of input and output (before and after the intended action or operation) I could have come up with a to-the-point description. I guess it must be do-able.
> I didn't quite get where i wanted
I am curious how you did solve this puzzle. I might learn from it and perhaps I could think of some improvements.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All.
Got a txt file, about 300.000 lines
I want to find a line that starts with the same word, Cut that line + the next one, Insert it in a new file.
Is there any way to do that?
123 Im a line that always start with 123, I can have spaces in the beginning
234 im the next line that needs to be copied with the above, I can have spaces in the beginning and alternating text
many lines
many lines
123 Im a line that always start with 123, I can have spaces in the beginning
234 im the next line that needs to be copied with the above, I can have spaces in the beginning and alternating text
tried with Macro, but that did'nt work out for me
hmmm, did not get any mail notification on your last post, so sorry for the late answer.
Well, I cant even remember what exactly I did, but I formatted the txt file in a nice way with NP++
And then i just scripted my way out of the problems with VbScript on an .asp page.
I started reading a bit about Reg exp. but I soon realized that it would be just as easy to use VbScript.
The Data is in all kind of different ways down the txt file, with no specific delimiter telling me where it belongs...... so I had to go complex.
Ended up with 884 lines of code, but that's including all the DB importing
Don't you just love an un delimited txt file :0)
Ok, tried this :
<Higlight tekst>, <F3>, <End>, <Home>, <Home>, <Shift-End>, <Shift + Arrow down>, <Shift + End>, <Ctrl-C>, <Ctrl-Tab>, <Ctrl-V>, <Enter>, <Enter>, <Home>, and <Ctrl-Shift-Tab>, <Home>, <Arrow up>, <Arrow Right>, <Shift + Arrow right 3 times>, <F3>
But it seems to always start at the same line, over and over again.......
And sorry for not mentioning, I'm on V/ 5.2
Some possibilities:
1. Use a tool to extract the multline regular expression you are looking for.
Suggested reading:
"Feature Request: Multi Search" (Open Discussion forum)
http://sourceforge.net/forum/forum.php?thread_id=1994407&forum_id=331753
I am not sure if this can be done (easily) with TextCrawler, but search the net and you may find a tool that allows you to do just what you want.
2. Use a regular expression to combine both lines you want to keep and use options to mark or only show those lines and then copy those.
Interesting description:
"Does N++ Support REGEX With Multiple Lines?" (Open Discussion forum)
https://sourceforge.net/forum/forum.php?thread_id=3004512&forum_id=331753
This is to give you a clue about what you _can_ do.
In your case: do _not_ use the Recursive Replace option.
You only want the single next line to be appended to the line starting with your "word", to be able to extract only those lines later.
You (may) want to break down the combined lines later again.
This could easily be done by replacing an identifier string you put there in the step before (like "#linebreak#") by a linebreak again.
Here's is just a teaser...
Move the cursor to the top of the document (Ctrl+Home).
User either the standard Ctrl+H or Ctrl+R advanced (TextFX) find/replace dialog.
Uncheck wrap mode.
Check or select regular expression mode.
In the Find field, enter:
^ *(123.*)[^1][^2]$
In the Replace field, enter:
\1#linebreak#
Replace all occurrences.
Now, you will have all your lines starting with "123" and the lines below it next to each other.
You can now go various ways to extract only those lines.
It may be just easiest to bookmark and copy all lines containing the identifier.
Move the cursor back to the top of the document (Ctrl+Home).
Open the normal find dialog (Ctrl+F).
In the Find field, enter the identifier:
#linebreak#
Check the Mark line option in the group options just below it.
Click Find All.
Close the Find dialog.
Menu_____ : Search
Option___ : Copy bookmarked lines
You now have all the lines you want. You can paste them in a new document.
You still have to replace the #linebreak# identifier by real linebreaks again.
Move the cursor back to the top of the document (Ctrl+Home).
Open the advanced replace dialog (Ctrl+R).
In the Find field, enter the identifier:
#linebreak#
In the Replace field, after clearing it, press Ctrl+M or Ctrl+Enter.
Uncheck regular expression mode.
Replace all occurrences.
Voila!
Let me collect te credits on this one!
A quicker way would be to insert _two_ #linebreak# identifiers, one for each wanted line, with a real linebreak in-between them.
In the _advanced_ Replace dialog you could just enter:
In the Find field, enter:
^ *(123.*)[^1][^2]$
In the Replace field, enter:
\1#linebreak#
#linebreak#
Of course, you have to press Ctrl+M or Ctrl+Enter after the first #linebreak#.
This will add an identifier to each line starting with 123 and insert an identifier before each following line.
You can select all lines again as described above.
Still, you have to remove all identifiers again after pasting the contents into a new document.
Magic explanation of the regular expression:
^________ look for the start of a line
*_______ accept any space characters before the keyword
123______ the keyword: the first word or string on the line
.*_______ accept any character following the keyword = the whole line
(123.*)__ group this expression to be able to re-place the match
Now we _are_ at the end of the line, but we have to include the linebreak to do the magic.
[^1]_____ match any character not 1
[^2]_____ match any character not 2
This will (only?) work with "not" matches and is just also including the CR LF linebreak characters.
$________ match the end of the line
I think I just noticed this last one isn't even necessary (in this case).
Find and replace do not work in Macros. It hasn't been implemented just yet.
The Regular Expression mode in Find and Replace (Ctl/H) works on only single lines. Volunteer, Fool4UAnyway, has some techniques for dealing with multi line edits. These techniques use the Find and Replace feature in plugin TextFX (see the Wiki page http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo ) . To do the 'cut' that you require, you must use the plugin TextFX Viz functions.
In summary, N++ has no easy method of doing what you want, as you described the problem, but using some ingenuity it is possible.
Now, the ability to edit based on existing strings is very dependent on the nature of those strings. If you could give us some specific examples of the strings, we may be able to spot something inherent in the find strings that will make the job easier.
You wrote:
<quote>
123 Im a line that always start with 123, I can have spaces in the beginning
234 im the next line that needs to be copied with the above, I can have spaces in the beginning and alternating text
<end-quote>
Sorry, these descriptions are not clear enough, especially the bit about 'I can have spaces'.
Here is a paste of some of the text file :
490 Lackierung
LACKIERUNG IN "GLANZSCHWARZ" WIE SCHL.NR. 668
490 Lackierung
LACKIERUNG IN "BRILLANTROT" WIE SCHL.NR. 308 SCHL.NR. 905 FüR VORFüHRFAHRZEUG (IAA-FRANKFURT) -VARTA-BATTERIE -BEREIFUNG MICHELIN
Individualfahrzeugdaten
943 Sondersteuerung
FRONT-, HECK-UND SEITENSCHWELLER IN WAGENFARBE DIAMANTSCHWARZ- METALLIC, WIE SCHL.NR. 181 (OHNE KONTRASTLACKIERUNG)
---
490 Lackierung
BAUABW: B9091.2 B9221.B LACKIERUNG IN "MATTHESBLAU-METALLIC" FE 97-5972 BASF GEM. B 9221.B
---
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
---
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
---
0940 Sonderwunsch
FRONT- UND HECKSCHüRZE SOWIE SCHWELLERVERKLEIDUNGEN O H N E KONTRASTLACKIERUNG.
---
0940 Sonderwunsch
BAUABW: B9223.B RADIO BECKER MEXICO ELECTRONIC CR MIT FREQUENZ-DIVERSITY WIE SCHL.NR. 0670, INKL. HIFI-LAUTSPRECHERSYSTEM WIE SCHL.NR.0676 GEM. B 9223.B
---
490 Lackierung
= Lackierung in lagunengrün-metallic, wie Schl.Nr. 266, gem. B 9208.C
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverkleidung ohne Kontrastlackierung
490 Lackierung
= Lackierung in mauritiusblau-metallic, wie Schl.Nr. 287, gem. B 9207.C
---
0940 Sonderwunsch
= Leuchtweitenregulierung, wie Schl.Nr. 510, gem. B 9230.C
---
0940 Sonderwunsch
= - Dachhimmel, A- und C-Säule in Leder Walknappa schwarz, wie Schl.Nr. 0330 (Bereitstellung erfolgt durch ZS-400) - elektrische Sitzverstellung für Fahrer und Beifahrer, wie Schl.Nr. 458, gem. SA 6518/25
---
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverbreiterungen o h n e Kontrastlackierung
---
490 Lackierung
= Lackierung in gletscherblau-metallic, wie Schl. Nr. 280, gemä� B 9233.C
---
490 Lackierung
= Lackierung in bronzitbeige-metallic, wie Schl. Nr. 0139, gem. B 9228.C
0940 Sonderwunsch
= Fahrer- und Beifahrersitz wie BMW 535i - Lordosenstütze für Fahrer, wie Schl. Nr. 0488
---
I'm so tired right now that I almost fall over, will continue tomorrow.
Almost had it though, using Ctrl-X
Got it to go through the file, but at the end it could not find my expression for F3, and started to copy wild. and only way to kill it was task manager :-(
Appreciate your help :-)
OK, I hadn't finished yet.
The \1 (digit one) in the Replace field is meant to re-place the (grouped expression) of the Find field.
I used, to find your matches:
^ *(\d+.*)[^1][^2]
To insert two identifiers at once, without appending both wanted lines, I replaced those with:
\1#linebreak#
#linebreak#
I bookmarked all lines with #linebreak# (as described above).
I copied those lines to a new document.
I removed all #linebreak# identifiers by replacing them with nothing.
This is what I got:
490 Lackierung
LACKIERUNG IN "GLANZSCHWARZ" WIE SCHL.NR. 668
490 Lackierung
LACKIERUNG IN "BRILLANTROT" WIE SCHL.NR. 308 SCHL.NR. 905 FüR VORFüHRFAHRZEUG (IAA-FRANKFURT) -VARTA-BATTERIE -BEREIFUNG MICHELIN
943 Sondersteuerung
FRONT-, HECK-UND SEITENSCHWELLER IN WAGENFARBE DIAMANTSCHWARZ- METALLIC, WIE SCHL.NR. 181 (OHNE KONTRASTLACKIERUNG)
490 Lackierung
BAUABW: B9091.2 B9221.B LACKIERUNG IN "MATTHESBLAU-METALLIC" FE 97-5972 BASF GEM. B 9221.B
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
0940 Sonderwunsch
BAUABW: B9217.B RüCKSITZBANK UND -LEHNE WIE BMW 535I GEM. B 9217.B
0940 Sonderwunsch
FRONT- UND HECKSCHüRZE SOWIE SCHWELLERVERKLEIDUNGEN O H N E KONTRASTLACKIERUNG.
0940 Sonderwunsch
BAUABW: B9223.B RADIO BECKER MEXICO ELECTRONIC CR MIT FREQUENZ-DIVERSITY WIE SCHL.NR. 0670, INKL. HIFI-LAUTSPRECHERSYSTEM WIE SCHL.NR.0676 GEM. B 9223.B
490 Lackierung
= Lackierung in lagunengrün-metallic, wie Schl.Nr. 266, gem. B 9208.C
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverkleidung ohne Kontrastlackierung
490 Lackierung
= Lackierung in mauritiusblau-metallic, wie Schl.Nr. 287, gem. B 9207.C
0940 Sonderwunsch
= Leuchtweitenregulierung, wie Schl.Nr. 510, gem. B 9230.C
0940 Sonderwunsch
= - Dachhimmel, A- und C-Säule in Leder Walknappa schwarz, wie Schl.Nr. 0330 (Bereitstellung erfolgt durch ZS-400) - elektrische Sitzverstellung für Fahrer und Beifahrer, wie Schl.Nr. 458, gem. SA 6518/25
0940 Sonderwunsch
= Front- und Heckschürze sowie Schwellerverbreiterungen o h n e Kontrastlackierung
490 Lackierung
= Lackierung in gletscherblau-metallic, wie Schl. Nr. 280, gemä� B 9233.C
490 Lackierung
= Lackierung in bronzitbeige-metallic, wie Schl. Nr. 0139, gem. B 9228.C
0940 Sonderwunsch
= Fahrer- und Beifahrersitz wie BMW 535i - Lordosenstütze für Fahrer, wie Schl. Nr. 0488
Alright?
\d+_____ match any consecutive string of digits, at least one
OK, it was a nice practice...
I just did a check with TextCrawler.
It took considerably less time.
Use the following regular expression to find and extract your matches:
^ *(\d+.*)\r\n.*$
This simply does it all in one pass.
You can copy your matches or directly save them to a file.
fool4uanyway
Thanks a billion :-)
Did the trick in NP++
Ill try TextCrawler also.
You wouldent happen to have a regular expression for putting all lines that match each other, underneith each other
ImALine
ImaLine
ImAnotherLine
ImAnotherLine
ImAnotherLine
ImTheThirdLine
Why, well why I have to do all of this is because I'm writing a script that imports it all to a database.
But I'm stuck at all these Lines as they seem to be several database fields put together as to what the costumer the ordered.
So I want to have a look at how many different types of lines that there is, so i can break them up, and put them in to the database as i wish.
But when I think about it, I could just copy a line to a new document, Do a Search and replace for the line i just copied, and replace it with nothing. That could work.
> Thanks a billion :-)
Dollars? Euro's?
> Did the trick in NP++
> I'll try TextCrawler also
I guess TextCrawler is the first way to go for this kind of exercises. Notepad++ suits for _editing_ texts, but when you want to extract etc. specific tools like TextCrawler can save a lot of (billions of) time(s).
> You wouldent happen to have a regular expression for putting
> all lines that match each other, underneith each other
I'm not sure if I understand you correctly, but I guess the answer is: no, not in Notepad++.
If you want all similar lines to be near each other, I guess you could use the sort function in the Text FX menu.
If you want to extract all lines, again, I advise to use TextCrawler.
> Why, well why I have to do all of this is because I'm writing
> a script that imports it all to a database.
You might want to import all data first and then simply sort it in the database. That's also quite an intended use.
> So I want to have a look at how many different types of lines
> that there is, so i can break them up, and put them in to the
> database as i wish.
In the database you could use some DISTINCT function.
In Notepad++ you can sort with the option to keep _unique_ lines only.
> But when I think about it, I could just copy a line to a new
> document, Do a Search and replace for the line i just copied,
> and replace it with nothing. That could work.
I guess you mean:
1. moving the first occurrence of a line/type to a new document
2. remove all other occurrences from the first document
The results would be the same.
My advise: use the most simple method.
Damm, I'm Stupid.......
This is the original file before editing :
Fahrzeugangaben
Fahrgestellnummer WBSHD91CENSORED_For Online._10Numbers
Typ-Code HD91
Typ M5 (ECE)
E-Baureihe E34 ()
Baureihe 5
Bauart LIM
Lenkung LL
Türen 4
Motor S38
Hubraum 3.60
Leistung 232
Antrieb HECK
Getriebe MECH
Farbe SCHWARZ (086)
Polsterung SCHWARZ VOLLEDER (0318)
Prod.-Datum 1988-09-19
Sonderausstattung
Nr. Beschreibung
354 GRUENKEIL-FRONTSCHEIBE
401 SCHIEBE-HEBEDACH, ELEKTRISCH
415 SONNENSCHUTZROLLO FUER HECKSCHEIBE
464 SKISACK
494 SITZHEIZUNG FUER FAHRER/BEIFAHRER
500 SCHEINW.WASCHANL./INTENSIVREINIGUNG
530 KLIMAANLAGE
560 LESELEUCHTEN IM FOND
663 BMW BAVARIA C ELEKTRONIC
676 HIFI LAUTSPRECHERSYSTEM
860 SEITLICHE BLINKLEUCHTEN VORN
944 NACHTRAEGLICHER UMBAU DURCH ZS
---
Fahrzeugangaben
Fahrgestellnummer WBSHD91CENSORED_For Online._10Numbers
Typ-Code HD91
Typ M5 (ECE)
E-Baureihe E34 ()
Baureihe 5
Bauart LIM
Lenkung LL
Türen 4
Motor S38
Hubraum 3.60
Leistung 232
Antrieb HECK
Getriebe MECH
Farbe MACAOBLAU METALLIC (250)
Polsterung SCHWARZ VOLLEDER (0318)
Prod.-Datum 1988-09-19
Sonderausstattung
Nr. Beschreibung
301 DIEBSTAHLWARNANLAGE MIT ZV
401 SCHIEBE-HEBEDACH, ELEKTRISCH
415 SONNENSCHUTZROLLO FUER HECKSCHEIBE
423 FUSSMATTEN IN VELOURS
500 SCHEINW.WASCHANL./INTENSIVREINIGUNG
530 KLIMAANLAGE
663 BMW BAVARIA C ELEKTRONIC
944 NACHTRAEGLICHER UMBAU DURCH ZS
----
So why don't i just get rid of all the empty lines
Make it put "LineText"; around every single line that has text
But then it should take the line under, and put it up after itself "Line1";"Line2";"Line3"; until it hits a line that contains "rzeugangabe" (Notice i clipped some of, (Fahrzeugangabe) because some lines is missing the first or two chars.)
That would give me on car on one line with "" around each Entity and seperated by ;
Could import that txt file directly into a db, and then i'm finally at my home base :-) Normalising of the database could begin :-)
Id that even possible?
> Damm, I'm Stupid.......
Yeah right, and I am a fool...
I'm not taking enough time now to consider (or try to figure out) what you are talking about.
But I guess (something like) that is what I described in the other thread I referred to earlier.
You probably could use the last (two) characters of "Fahrzeugangaben" to make the "Incursive Replacement" method work.
A safer way would be to append a more distinctive identifier to those lines first, so you may be more sure that other lines won't interfere with the magic.
Thanks mate.
I didn't quite get where i wanted (In last post), but using your methods I got it all setup in the end :-)
OK, I guess. I didn't (take a) look back after my post. There wasn't a reply to it either.
Perhaps if you gave an exact example of input and output (before and after the intended action or operation) I could have come up with a to-the-point description. I guess it must be do-able.
> I didn't quite get where i wanted
I am curious how you did solve this puzzle. I might learn from it and perhaps I could think of some improvements.