How to search and get the values from the file
Moderator: DosItHelp
Re: How to search and get the values from the file
Hi dbenham/Squashman
Yes the code is working for the sample data that I provided, but the actual file has binary and ascii characters too. I'm trying to post the content of the file in the post but I'm getting an error message saying 649524 characters. The maximum number of allowed characters is 60000. I tried to post in code tab but no success. Is there a way I can paste the content of the file.
Thanks,
Raju
Yes the code is working for the sample data that I provided, but the actual file has binary and ascii characters too. I'm trying to post the content of the file in the post but I'm getting an error message saying 649524 characters. The maximum number of allowed characters is 60000. I tried to post in code tab but no success. Is there a way I can paste the content of the file.
Thanks,
Raju
Re: How to search and get the values from the file
Upload it to your web space and post a link.
Re: batch variable progress bar string manipulation
Thank you all for your support . I uploaded file to below link and you can download the actual file that I'm talking about.
http://www.filehosting.org/file/details ... t_jobs.txt
Regards,
Somaraju
http://www.filehosting.org/file/details ... t_jobs.txt
Regards,
Somaraju
Re: batch variable progress bar string manipulation
somu_june wrote:Thank you all for your support . I uploaded file to below link and you can download the actual file that I'm talking about.
http://www.filehosting.org/file/details ... t_jobs.txt
Regards,
Somaraju
Put it on a different site. I am not giving them my email address to request the download.
Re: How to search and get the values from the file
Here we go
https://www.box.com/s/81us5wjvnp5nfuxz17jm
I uploaded to box and sharing the link. Please let me know if this is ok.
Thanks,
Raju
https://www.box.com/s/81us5wjvnp5nfuxz17jm
I uploaded to box and sharing the link. Please let me know if this is ok.
Thanks,
Raju
Re: How to search and get the values from the file
This works with your sample data here if you download GNUsed
Load_all_search_file_into_WRK_table_MedMgmt
Seq_Find_What_jobs_use_attributes_MedMgmt
Code: Select all
@echo off
sed -e "/BEGIN DSJOB/,/Identifier/!d" -e "/BEGIN DSJOB/d" -e "s/^ *Identifier *//" -e "s/\x22//g" Test_jobs.txt >found.txt
Load_all_search_file_into_WRK_table_MedMgmt
Seq_Find_What_jobs_use_attributes_MedMgmt
Re: How to search and get the values from the file
This works using Dave's repl.bat
Code: Select all
type Test_Jobs.txt | repl "^(BEGIN DSJOB)\r?\n" "$1" m | findstr /r c:"BEGIN DSJOB.*Identifier " | repl ".*\x22(.*)\x22.*" $1 >found.txt
Re: How to search and get the values from the file
@foxidrive - You almost got it. Your FINDSTR command is missing a / before the c: option. ( or else remove the space so the option becomes /rc: ) The command as you gave it happens to work with the provided input, but I think it is fortuitous.
I would probably use " *" instead of ".*"
Dave Benham
I would probably use " *" instead of ".*"
Code: Select all
type Test_Jobs.txt | repl "^(BEGIN DSJOB)\r?\n" "$1" m | findstr /brc:"BEGIN DSJOB *Identifier " | repl ".*\x22(.*)\x22.*" $1 >found.txt
Dave Benham
Re: How to search and get the values from the file
Oops. It's funny that it worked with that syntax.
I wasn't sure if the whitespace was TABs and was too lazy to check.
I just fiddled until it worked and wham!
I would probably use " *" instead of ".*"
I wasn't sure if the whitespace was TABs and was too lazy to check.

Re: How to search and get the values from the file
Thank you so much for the help. It's working now.
Re: How to search and get the values from the file
Hi foxidrive,
I'm testing your command
I'm getting output in double quotes like below
"CopyOfpxHmkEciPrcssDtExtr"
"CopyOfpxHmkEciReturnCdcData"
"CopyOfSeq_Eci_Return_Interface"
"CopyOfSeq_MstSeq_ECI_Return"
"CopyOfpxIBCPhpOutboundCount"
"CopyOfpxIBCPhpOutboundExtract"
"CopyOfSeq_MstSeq_Php"
"CopyOfSeq_Php_Interface"
is there a way to remove the double quotes beofre loading in to a file.
Thanks,
Raju
I'm testing your command
Code: Select all
@echo off
sed -e "/BEGIN DSJOB/,/Identifier/!d" -e "/BEGIN DSJOB/d" -e "s/^ *Identifier *//" -e "s/\x22//g" Test_jobs.txt >found.txt
I'm getting output in double quotes like below
"CopyOfpxHmkEciPrcssDtExtr"
"CopyOfpxHmkEciReturnCdcData"
"CopyOfSeq_Eci_Return_Interface"
"CopyOfSeq_MstSeq_ECI_Return"
"CopyOfpxIBCPhpOutboundCount"
"CopyOfpxIBCPhpOutboundExtract"
"CopyOfSeq_MstSeq_Php"
"CopyOfSeq_Php_Interface"
is there a way to remove the double quotes beofre loading in to a file.
Thanks,
Raju
Re: How to search and get the values from the file
The last command in the sed line removes double quotes. Are you sure you tested this code?
Try it again in an empty folder.
Try it again in an empty folder.