How many of you have gotten calls from counsel, clients and friends asking whether, “Can Copilot do X?” So far, my answer has been, “Not yet, but it might tell you how to do it if you ask.” This was yesterday’s question and Copilot’s solution:


Hi Greg,

I now have access to CoPilot Enterprise at work. 

Is this something CoPilot could tackle?

I have 56 ASCII files that look like the pic below. 

Could CoPilot ingest the 56 files and make me a summary list of file name, and first line (head 1) for all files???  (or field values of the columns 3 and 6). 

If this is something I can stop by and you can walk me through in 15 min, I’ll bring ya a bottle of something red & good.  


I do not work for wine.  Really. Well sometimes for good clients past and present. My first instinct was to recommend a Power Automate macro as a codeless solution. I would have kluged together an old school .BAT file after pulling a file list, but that is just me being lazy.


Copilot prompt: write a .bat script to cycle thru a directory of ascii files and copy the name of the file and the first line of each file into a delimited ascii file

Copilot Response:

Certainly! Let’s break this down into steps:

  1. Loop through ASCII files in a directory: To iterate through the files in a directory, you can use a for For example:

for %%f in (*.txt) do (

REM Your code here

)

  1. Extract the filename and first line: To extract the filename and the first line of each file, you can use the for /f Here’s how you can do it:

for %%f in (*.txt) do (

for /f “usebackq delims=” %%l in (“%%f”) do (

REM Extract filename (%%f) and first line (%%l)

)

)

  1. Write the data to a delimited file: You can append the filename and first line to an output file using echo:

for %%f in (*.txt) do (

for /f “usebackq delims=” %%l in (“%%f”) do (

echo %%f,%%l >> output.txt

)

)

Putting it all together, here’s a complete batch script:

@echo off

setlocal enabledelayedexpansion

REM Output file

set “output=output.txt”

REM Clear existing output file

echo. > “!output!”

REM Loop through ASCII files

for %%f in (*.txt) do (

REM Extract filename and first line

for /f “usebackq delims=” %%l in (“%%f”) do (

REM Append to output file

echo %%f,%%l >> “!output!”

)

)

REM Done

echo “Data written to !output!”

Replace *.txt with the appropriate file extension for your ASCII files. The resulting output.txt will contain the filename and first line of each file, separated by a comma. Adjust the script as needed for your specific requirements12. 🚀


I thought this was a great example of the value that generative AI offers. I sent it back altered to fit the request. It won’t do your laundry, but it may tell you how to remove that stubborn wine stain. Back in my litsupport days I had a sign on my desk that said, “Have you turned it off and on before you ask me to fix it?” Modern litsupport and IT help desk signs may well read, “Have you asked Copilot before you ask me to fix it?”

Greg Buckles wants your feedback, questions or project inquiries at Greg@eDJGroupInc.com. Book a free 15 minute ‘Good Karma’ call if he has availability. He solves problems and creates eDiscovery solutions for enterprise and law firm clients.

Greg’s blog perspectives are personal opinions and should not be interpreted as a professional judgment or advice. Greg is no longer an investigative journalist and all perspectives are based on best public information. Blog content is neither approved nor reviewed by any providers prior to being published. Do you want to share your own perspective? Greg is looking for practical, professional informative perspectives free of marketing fluff, hidden agendas or personal/product bias. Outside blogs will clearly indicate the author, company and any relevant affiliations. 

Greg’s latest nature, art and diving photographs on Instagram.

[instagram-feed num=1 imageres=thumb showfollow=true

0 0 votes
Article Rating