ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Coding Snacks

Open files and rename or save as with new file name

<< < (2/3) > >>

rjbull:
I have had a look rjbull recommendation, and not been too techie, I am finding it hard to work out how to do it.

If anyone can give further assistance of LMOD, then this would be appreciated.
-KaysLover (February 05, 2009, 10:17 AM)
--- End quote ---

Without knowing what your data looks like, e.g. a PDFtoText dump, and (very important) whether it's consistent, it's not really possible to give detailed help.

LMOD can, amongst other things, extract particular bits of text from particular lines, so if you know where your target text is, and it's always in the same place, you can use it to build a temporary batch file to do the renaming for you.


KaysLover:
The file is created by using Crystal reports.

The text that is required to be extract will always be on say line 5. There is a date at the end of line and therefore if there is a way to extract text from line 5. The delimiter should be say 3 continuous space.

How would LMOD input cards look like?

rjbull:
Augh, Crystal Reports!   :(

Suppose you have a file temp.txt like this:


--- ---apple
banana
cherry
damson
Line 5; date is last item 2009-02-08
feijoa
greengage

Then to extract the last item on line 5 with LMOD, do this:


--- ---lmod /L5 [$!] < temp.txt

which gives as output:



C:\zdir>lmod /L5 [$!] < temp.txt
2009-02-08

C:\zdir>

--- End quote ---

KaysLover:
rjbull, thanks for your valuable input so far, however I have the following question:-

The fact that I use the code lmod /L5 [$!] < temp.txt, I have several temp files and if I run the command several time, will it not just override the file? I need to be able to append to the file.

rjbull:
I have several temp files and if I run the command several time, will it not just override the file? I need to be able to append to the file.
-KaysLover (February 09, 2009, 05:43 AM)
--- End quote ---

In haste: you need an infusion of batch file magic - here you'd have to redirect the result to a file, but appending instead of overwriting, e.g.

lmod /L5 [$!] < temp.txt >> all.txt

instead of

lmod /L5 [$!] < temp.txt > all.txt

i.e. using double redirection symbol ">>" appends rather than overwrites.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version