A Few Tools for Your Computer - Page 7 - Politics Forum.org | PoFo

Wandering the information superhighway, he came upon the last refuge of civilization, PoFo, the only forum on the internet ...

Anything from household gadgets to the Large Hadron Collider (note: political science topics belong in the Environment & Science forum).

Moderator: PoFo The Lounge Mods


One might argue that 'a-line-ending-in-a-number' isn't specific-enough, since someone might quickly put in a photo filename (like the sample 'DSC_1459' above) and if they left-off the '.JPG' extension, then *that* line would end with a number, '9', which would throw-off the regular, desired results provided by that line of Bash scripting.

So, to 'upgrade', let's focus on the 'fixed', *predictable* portions of any given entry, meaning the 'code block' at the end:


cat 220315_index | tr '\n' '~' | sed 's/[0-9]~~/&\n\n/g' | grep "$CODE~~$"



Just realized that the existing script lines don't really address the 'DSC_1459' issue above -- what if a line happens to end in a digit, followed by two carriage returns, within an entry? It would then be transformed into an undesired end-of-entry designation (the entry's 0-9 taxonomy-line digit followed by two tilde '~' characters) (*any* normally-unused character could be used instead of the tilde character).

So here's the fix, if you didn't happen to get to it before me:

sed 's/|[0-9]~~/&\n\n/g'

Note the '|' 'pipe' character now as the very first character to be found, *necessarily* followed by a single digit, 0 through 9, and then two tilde characters -- this is now officially the 'end-of-entry' designation used based on the whole text file of entries, from top to bottom, however long or short.
  • 1
  • 3
  • 4
  • 5
  • 6
  • 7

The literal governor of Florida with the rest of t[…]

If puberty blockers and hormone treatments are all[…]

Russia and China are lifting sanctions against No[…]

Who invited him? It's literally the first word o[…]