Here's a Script to rename records with the first line and tr

I had over 3500 records of plain text that were named in sequential (these were the product of unix text processing, csplit on big files, etc.)

The problem was that when I used csplit, I’d have one file with a blank line here and there at the top, and others with it at the bottom.

The other problem was that I have to keep the files intact, but have another script that is making a spread sheer from certain contexts it finds in the documents… renaming the record to something meaningful not only helps that process, but makes it easier to see the records for what they are…

enter this script. In my records, the first line of the file was an ideal title. I also thought I’d add a handler to remove extra empty lines at the top and bottom of the file.

It has handling built it so that it only operates on Text, TXT, RTF, RTFD, and unknown files. So, if you select a batch of records, and happen to get a PDF and a webarchive in there, have no fear – this script ignores those record types and moves on to the next record.

Rename with first line and Trim spaces from top and (6.44 KB)