Grep Tricks

Often I need to mess with the content of arrays. They often look like this.

“99”, ”

And I’ll want to delete the contents of one section.


^"([0-9]*)"(,"")(,"[a-zA-Z0-9 ,-/'&#ñéá]*")
"\1"\3\2

This says, start at the beginning of each line ^, look for double quotes, then a number—repeated as many times as you want, then another double quote,

Look for any letter, number, and a bunch of special characters that don’t include double quotes “.

([a-zA-Z0-9 ,-/’&#ñéá]*)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.