- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: some scripting now.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2005 10:17 PM
12-08-2005 10:17 PM
to me you
what where when
I want them to as follows.
To Me You
What Where When
I can do it with some scripting, but want a quick answer, so can not waste time on it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2005 10:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2005 11:05 PM
12-08-2005 11:05 PM
Re: some scripting now.
cat test555.txt | while read line; do for i in $(echo ${line}); do first=$(echo ${i} | cut -c1|tr "[:lower:]" "[:upper:]"|tr "\n" " " ; rest=$(echo ${i} | cut -c2- | tr "\n" " "); echo ${first}${rest}; done; done
JRF's solution worked...
I must learn PERL>>>>>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2005 11:38 PM
12-08-2005 11:38 PM
Re: some scripting now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2005 06:32 PM
12-09-2005 06:32 PM
Re: some scripting now.
mac()
{
for arg in a b c d e f g h i j k l m n o p q r s t u v w x y z
do
UP=$(echo ${arg}|tr "[a-z]" "[A-Z]" )
echo "s/ ${arg}/ ${UP}/g"
echo "s/^${arg}/${UP}/"
done
}
mac > sedfile
cat test | sed -f sedfile
Yes perl is better
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2005 09:12 AM
12-10-2005 09:12 AM
Re: some scripting now.
perl -pe 's/\b(\w)/uc($1)/ge' your-file
-p loop trhough input reading into and print $_ after processing
-e program text to follow
s/regexpr/expr/eg for each occurence (g) of regexpr in $_ substitute it by ethe value of expr after executing expr
\b(\w) = remember a 'word character' following an word boundary in $1
uc($1) = upcase $1
grins,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2005 02:56 AM
12-11-2005 02:56 AM
Re: some scripting now.
Hein's solution differs from mine in length but also in what constitutes a "word". It's worth noting :-))
You can test either Hein's or my solution interactively by omitting the filename argument at runtime.
The difference in input (denoted with "<" and the corresponding output (">") is thus exposed;
< this is jrf's code-running
> This Is Jrf's Code-running
< this is hein's code-running
> This Is Hein'S Code-Running
Note the treatment characters that follow a single quote (apostrophes) or a hyphen.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2005 03:17 AM
12-11-2005 03:17 AM
Re: some scripting now.
Good catch James.
We would need to know what defines a word for the problem to be solved.
Anyway... it was of course mostly to highlight an alternative approach.
We can make it work like Jrp's code.
Using his example using:
[root@music /tmp]$ cat x
this is jrf's code-running
[root@music /tmp]$ perl -pe 's/(^\w|\s\w)/uc($1)/ge' x
This Is Jrf's Code-running
The tricky part now is the first word which has no whitespace, and needs an 'or' construction. Using the boundary match \b avoids that.
Hein.