save result of search and replace feature PowerGREP - powergrep

I want to save result of search and replace feature of PowerGREP to excel or csv file that contains separate column for replaced by, full file name and what is replaced.
Can anyone help on this ?
I know we can export result (as text file) but that's not what I need.

Related

How to append one text file to another text file

I need to append 1 text file to another text file.
I've done several keyword searches, and keep coming up with instructions on adding text to an existing file ... which is not the same as appending one text file to another text file.
In a well-designed language, it might look something like the line below, with the contents of source2 added to source1.
Append(path/source1, path/source2, ResultCode)

Text from excel cells to individual word files

I have an Excel file that looks like this:
A B
1 Title_1 Description_1
2 Title_2 Description_2
Is it possible to output each title and description to individual Word files with column A for file name of the Word file and column B to its content?
For example the macro would create a new Word file give it file name 'Title_1' and copy 'Description_1'. Then create a new Word file again give it file name 'Title_2' and copy 'Description_2'. And do this until all data from the Excel file is copied.
Thank you for your time. :)
What you want to look into is called a "Mail Merge". Use a search engine and look for "mail merge excel word 2007" (or whatever year of MS Office that you are working with). You can create an excel macro that creates instances of word, populates the word doc with whatever you want from your excel spreadsheet, save the word doc with any name you want, export to PDF, etc.
Here are some hints to start you off:
in the VBE go to tools references and add one for Microsoft Office.
Use these two lines of code to create an object:
Dim MyWord
Set MyWord = CreateObject("Word.Application")
Now you can precede any code for word with MyWord for example to add a Document in word would be Documents.Add so remotely from Excel it will be MyWord.Documents.Add
You will want to loop through your cells in excel. On each iteration of the loop populate two variables, one with the text you want in the file and one with the file name.
Then simply use MyWord to enter the results of the variable then save the file using the result of the other variable.
Post back if you get stuck but give it a go first.
This is easy form any operating system, assuming you are using windows you will use a batch script(easiest).
First use save as/export on the data ribbon to save as a CSV.
Second you will need a batch script to read the CSV and use the first value as the file name the second value as the contents. If you want it to be a doc or docx instead of txt just rename the file in the same loop or add it to the file name when you output to text.
Here is a similar post with all the resources you would need to slap together a quick batch script.
read csv file through windows batch file and create txt file

Export specific data from a selected cell's row into a CSV file

I have been searching for a solution to this, but it seems like I cannot find it.
So basically, I want to select e.g. H2 and then run the macro.
Then it should copy/paste some specific cells into a new CSV file, e.g. O2 and F2. I also want a fixed value that should always be there, called "No".
The first row of the CSV file should be "UTF-8". The next (2nd row in the CSV) should be some headers that is fixed, just as the UTF-8.
Could a solution be to copy all the relevant data into another sheet with the proper format, and then just export that sheet as a CSV?
Illustration:
"UTF-8"
"Name","ID","Email","Customer"
"H2","O2","F2","No"
Solution ended up being exporting the correct data into another sheet with the proper setup, using the following.
Sheets("Sheet1").Range("XX:XX").Copy Destination:=Sheets("Sheet2").Range("XX")

How to add line numbers to a file in Pentaho Data Integration (Kettle)?

I have a file names.txt with this data:
NAME;AGE;
alberto;22
andrea;51
ana;16
and I want to add a new column N with the line number of the row:
N;NAME;AGE;
1;alberto;22
2;andrea;51
3;ana;16
I've been looking and what I found was something related with Add sequence. I tried but I don't know how.
Thank you very much.
The Add Sequence step will get the job done, but you don't even need that. Both the CSV file input and Text file input steps can add a row number to the input rows. For the 'CSV file input' step it's called 'The row number field name (optional)'.
For Text file input, check the 'Rownum in output?' box on the Content tab and fill in the 'Rownum fieldname' text box.
I'm really baffled why you couldn't figure out the Add sequence step. It should work with no changes at all. Just drop it in and connect the output of the csv file to it and the sequence should appear as a field name called 'valuename'. I would change that personally, but still, it should work.

excel macro to read text file and find matches in cells

I really could use some help
I have two .txt/csv files that I need to read from into my excel file.
In my excel file I have a whole column, each cell containing string of characters and I need to write a script to be able find matches and and copy an adjacent column from that txt file.
An example of a single row on my txt file is shown below:
"AB101AA","AB10 1AA","AB101A","AB10 1A","AB101","AB10 1","AB10","AB10","AB","10",394251,806376,,
"AB101AF","AB10 1AF","ABERDEEN","ABERDEENSHIRE",,"ABERDEEN, CITY OF"
My excel file would have a cell which probably say "AB101AF" and i want the corresponding cell to run through a million rows and find the match and then find the corresponding nth cell on the txt file and return it on the excel spreadsheet example "ABERDEEN, CITY OF".
I know I havent been helpful in explaining the issue. But any help would be appreciated.
Thank you
Depending upon the size of your text file you could import the file using the GetExternalData option in Excel. This would allow you to load your data into a different Sheet and then use a lookup to your data from the main Sheet. Using Match and/or vlookup should help here.
You could also add a workbook connection to the text file and search using the connection.