Assuming a basic CSV — no commas or line breaks inside quoted fields, this will pick up the 4 fields, duplicate one of them, and insert constants:
Find: ^([^,]+),([^,]+),([^,]+),([^,]+)$ ^ anchor to start of line ( start a capture buffer, the first capture buffer is referenced with \1, etc. [ start a character class ^, search for anything which isn’t a comma ] finish the character class + one or more occurrences (use * if you might have empty fields) ) finish the capture buffer , look for a comma … $ anchor to end of line Replace: \1,\1,xxx,\2,\3,yyy,zzz,\4 You could also import the CSV into a spreadsheet, do the manipulation, and export as CSV. Cheers > On 2023-02-19, at 11:54, Nello Lucchesi <[email protected]> wrote: > > I’m new to scripting BBEdit and columnular transformations. > > I’d like to create/modify/steal a script to transform a csv file containing > financial data from my credit card company’s format into the format exported > by Mint (so that I can import the resulting Mint imposter into Quicken for > Mac). > > Credit card CSV (Input) > Date, Id, Amount, Description > > Mint CSV (Output) > Date,Description,Original Description,Amount,Transaction > Type,Category,Account Name,Labels,Notes > > The new columns will be either: > Constants, > Empty. > Duplicates of other columns > > Can someone please point me in the right direction? Ideally, can you point > me towards a script that does most of this and that I can modify? > > Thank you. > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/D4B96FA2-0F35-42ED-BED8-E78E10791A56%40gmail.com.
