R
Ruby Student
[Note: parts of this message were removed to make it a legal post.]
Team,
A colleague asked me if I could write a script to:
Read a text file where each record has two words.
If the second word in the record is not 100% uppercase, write it to a file
and convert it to uppercase.
I wrote it in Ruby in about 5 lines using IO.foreach("/tmp/somefile.txt") do
|file| for the input file and fo = File.open("/tmp/somefile.out","a+") for
the output file, upcase method.
Then she threw a curve ball at me telling me that she wanted it in Korn
Shell using regular expression.
The facts are that I don't know how to do this using regular expressions.
I am not asking anyone to solve for me, but if you can tell me:
How do you compare, using regular expression, the second word in the input
record for upper case. In other words, if the second word has at least 1
lower-case char, it has to be flagged and translated to upper-case.
I will deal with the I/O issues in Korn Shell.
Thank you
Team,
A colleague asked me if I could write a script to:
Read a text file where each record has two words.
If the second word in the record is not 100% uppercase, write it to a file
and convert it to uppercase.
I wrote it in Ruby in about 5 lines using IO.foreach("/tmp/somefile.txt") do
|file| for the input file and fo = File.open("/tmp/somefile.out","a+") for
the output file, upcase method.
Then she threw a curve ball at me telling me that she wanted it in Korn
Shell using regular expression.
The facts are that I don't know how to do this using regular expressions.
I am not asking anyone to solve for me, but if you can tell me:
How do you compare, using regular expression, the second word in the input
record for upper case. In other words, if the second word has at least 1
lower-case char, it has to be flagged and translated to upper-case.
I will deal with the I/O issues in Korn Shell.
Thank you