# Extract every "#" and 6 following characters to new text file



## pasc (Jun 21, 2014)

So, I have this one



> skewness: -2.94824
> Colors: 15
> Histogram:
> 4: ( 88, 80, 80) #585050 srgb(88,80,80)
> ...


and I want to extract all the hex values (f.e. #F8C808).

I want to avoid duplicates and paste them all in a new text file like so:

#585050
#C87038
.
.
.

Is this possible under dos ?


----------



## foxidrive (Oct 20, 2012)

This does not remove duplicates.


```
type file.txt |repl ".*(#......).*" "$1" a >newfile.txt
```
This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat

Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.


----------



## pasc (Jun 21, 2014)

Perfect ! 

I lovethis forum  Thanks


----------

