I'm pretty new to emacs, so I'm still learning all the functions.
I'm trying to remove certain metadata from each line of several large .txt files (Bible translations) and was wondering if if there was a way to search for and delete numerals above a certain value or to delete a specific column (the 4th) separated by TAB characters.
BOOK <TAB> CHAPTER# <TAB> VERSE# <TAB> VERSE-ID# <TAB> TEXT
The 4th field is a universal verse number starting at "10" and increases sequentially by 10s, so it becomes quite large - far larger than any other numeral in the file, which would otherwise be less than 300.
An example of what I'd like to do would be changing this:
PSALMS 150 5 164000 Praise him upon the loud cymbals: praise him upon the high sounding cymbals.
PSALMS 150 6 164010 Let every thing that hath breath praise the LORD. Praise ye the LORD.
to this:
PSALMS 150 5 Praise him upon the loud cymbals: praise him upon the high sounding cymbals.
PSALMS 150 6 Let every thing that hath breath praise the LORD. Praise ye the LORD.
The files also are divided into books by org-mode headings:
* THE NEW TESTAMENT
** The GOSPEL According to Matthew
MATTHEW 1 1 231460 The book of the generation of Jesus Christ, the son of David, the son of Abraham.
I suppose a delete-by-column function would have to be iterated, but that's not an issue for me as I can easily whip up a macro. Messing up the formatting (i.e. leaving an empty field) should be easy enough for me to clean up, so simply either deleting the column or an arbitrarily large numeral is acceptable.
awk
for this kind of manipulation. And we'd need a few more examples of what you want to do in order to be able to generalize (e.g. is it any number that's greater than 300 that should be deleted or only numbers in the fourth field? If the latter, deleting the big numbers but not the smaller numbers will change the structure of the file - is that acceptable?) Consider editing your questions and adding some additional examples that would enable somebody to generalize it properly. – NickD Oct 14 '19 at 2:16awk
to see if it can do what I need! – augustinus Oct 14 '19 at 3:12