Sign in to follow this  
Followers 0
davzell13

Find a number in txt or xls file

5 posts in this topic

Hello, excuse my bad english i'm french.

i have a list with my client number and an ID associate to this client.

N° client          ID
 NUMER000575       65657cf30c8gdsgfdgfd88b4588
 NUMER000576       65657d14dsgfsgfsgssdfdsf4595
 NUMER004218       6565af2b948b09afe58b45e6dsf
 NUMER270575       6565bdcd94fef998228b456bff

at the start, my script recover the number of my client in an other file.

Example i want find the 575 in my column "N° client" and copy the ID in front of.

But the 575 is also in the 270575 (last line) 

Is it possible ? 

 

Second question, my list is on a txt file or in a XLS file 

Is it possible to read in the XLS file without Excel installated ?

 

thanks.

 

 

 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$txt = FileRead("1.txt")
$n = "575"
$id = StringRegExpReplace($txt, '(?s).*\s*NUMER0*' & $n & '\s*(\w+).*', "$1")
If @extended Then Msgbox(0,"", $id)

You can read your file if in txt format using FileReadToArray

BTW please avoid double posts (both French and English forums)  ;)

Edited by mikell

Share this post


Link to post
Share on other sites
$txt = FileRead("1.txt")
$n = "575"
$id = StringRegExpReplace($txt, '(?s).*\s*NUMER0*' & $n & '\s*(\w+).*', "$1")
If @extended Then Msgbox(0,"", $id)

You can read your file if in txt format using FileReadToArray

BTW please avoid double posts (both French and English forums)  ;)

thanks, but when i try the script it doesn't work.

What is the use of "@extended ?

 

Share this post


Link to post
Share on other sites

erratum, it's ok, i have forget the 0 after NUMER :)

but if i search the number 270575 it dosn't work because of the NUMER0 

i'm going to try to adapted this script

Share this post


Link to post
Share on other sites

In your text from post #1 I saw this

NUMER270575       6565bdcd94fef998228b456bff

So I assumed that the 'N°client' was composed of NUMER + 6 digits
If it should be NUMERO + digits you just have to insert the 'O' (letter) after NUMER in the expression  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0