ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA - how to capitalise the first word of every line

<< < (4/4)

BigVent:
Either way gentlemen... Thank you for the banter.

MilesAhead - thanks for being a good sport. The tools you suggested are great. I downloaded & agree.

Tao - I scan everything to a single file... But that's just me. Handle it all at once & done.

We're just geeks plain and simple. All ways work.  :Thmbsup:

OP: if you're still reading... Find the way you prefer & roll with it.

There are many many ways to take care of what you need.

c.gingerich:
@TaoPhoenix I just happened to read this... thanks for the mention! :D

Hallo Stormproof!

Kingsoft writer may have some ways to help.

(P.S. these "fast posted screen shots" are from Chris Gingerich's NANY this year! This is what it's for!)

So suppose you have this hymn fragment etc.

oh lord
tell me to stay strong
let me hold to thy name

In Kingsoft Writer

http://i.imm.io/1m26C.png
 (see attachment in previous post)
-TaoPhoenix (December 11, 2013, 07:53 AM)
--- End quote ---

AbteriX:
IDEA - how to capitalise the first word of every line and behind an dot?


I think every text editor with Format Sentence-Case should be able to do that. E.g. Notepad2.




To work on only the first char of every line use a text editor with \L, \U regex metachars like EmEditor.
Find: ^(\w)
Repl: \U\1




Or with XYplorer:

--- Code: Text ---$file = readfile("c:\Temp\input.txt");    $out="";   foreach( $line, $file, "<crlf>"){         $first = recase(substr($line, 0, 1), "upper");         $rest  =        substr($line, 1);         $out   = $out . $first . $rest . "<crlf>";   }   text $out;  //writefile("c:\Temp\out.txt", $out);




Or with PowerShell (v2.0 Syntax)

#Upper case first char in line, here also chars after dot, exclamation or question marks too:
Get-Content hymn-book.txt | ForEach-Object{ [Regex]::Replace($_, '^\w|[.!?]\s+\w', {param($mymatch) $mymatch.Value.toUpper()})}


Note: "ForEach-Object" can be shorten to "foreach" and even to just "%"


.

stormproof:
Being naive and not ever having done programming, I spent a couple of days bashing through it.

The Kingsoft Office approach was great - however it removed every upper case except for the first letter of the line. 
So "thank you Jesus" became "Thank you jesus"

Plus I had the bright idea of putting verse numbers like so - "2)" instead of "2."  So I had all the verses to do as well.
However, Find and Replace was very helpful, and helped to rationalise what had been quite a haphazard set of capitalisings.

I ended up with a sore bum and a muzzy head but all done.

Just to clarify - we started with a 30 year old xeroxed book, scanned in and OCR'd it to separate pages, copied and pasted to a master document, spellchecked it, corrected it and corrected it again.
Then did the capitalising bit.
Then made it so pages don't begin half way through a verse.
Then printed to PDF.

Next will be to print as required.

They are songs from the early days when we had revival.  We don't now, but it's inspiring to read what people wrote from their experience.
Be nice to get there again.

So - having used a Stone Age method this time round, and not knowing how to get into the mysteries of Powershell etc, I'd quite like to learn.  Any recommendations? 
I'm not terminally daft yet, and sort out configuration and malware for friends,  It's just the next step and I don't know where to begin.
I'll have another similar project in a month or so, and it would be a good learning project.

What do you collectively think?

stormproof:
Sorry I forgot to thank you all for your time and advice.
 :-[

Navigation

[0] Message Index

[*] Previous page

Go to full version